matlab - how to cut a small portion of image using ginput? -


i have image , want cut small region of image using ginput. got rectangle using following code.how cut image in area?

[x1 y1]=ginput(2); [x2 y2]=ginput(2); [x3 y3]=ginput(2); [x4 y4]=ginput(2); 

assuming want separate maximum rectangular area marked 4 user inputs, image can segmented using following code segment. let me know if not fulfill requirement.

img = imread('cameraman.tif'); imshow(img); [x, y] = ginput(4); img2 = img(min(y):max(y),min(x):max(x)); imshow(img2); 

assuming 2 user clicks required @ top left corner , bottom right corner of intended region segment, above code can modified follows.

img = imread('cameraman.tif'); imshow(img); [x, y] = ginput(2); img2 = img(min(y):max(y),min(x):max(x)); imshow(img2); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -