You must Sign In to post a response.
  • Category: .NET

    Crop sub images from an image

    Hello
    I want to crop several sub images (iwe) from an image (b1) just by clicking in MATLAB.
    I dont know how to complete the code, please help me with it , Thanks guys.
    my code until now:
    function [iwe,y,x]= wetimcrop1(im,a);
    a= 50;
    % [y,x]=ginput(4);
    iwe= zeros(8,8);
    for i=1:a
    [y,x]= ginput(1);
    iwe(:,:,1)= imcrop(im,[y x 7 7]);
    end
    -------
    b1= imread(['b1.tif']);
    figure= imshow(b1)
    [iwe,y,x]= wetimcrop1(b1,a);
    --------
    the error is:

    Undefined function or variable 'a'.
    Error in wimcrop (line 4)
    [iwe,y,x]= wetimcrop1(b1,a);
  • #764302
    Hai Danya,
    Yes, you can crop image from the image in MATLAB.
    Please find below link for the code snippet and you can compare your code with this:

    https://www.researchgate.net/post/Is_it_possible_to_automatically_crop_images_in_MATLAB_from_any_image

    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments