필터 지우기
필터 지우기

Find Xmin and Ymin to Imcrop an image in Matlab

조회 수: 5 (최근 30일)
Manpreet
Manpreet 2015년 4월 30일
댓글: Harold Getenga 2017년 12월 12일
I want to crop my image. Cropping of the image using coding is as follow I = imcrop(I,[xmin ymin width height]). I know the width and height of image, but I donot know how to find xmin and ymin cordinates of an image from the different pixels values of an image. sum() or any() or find() function can be used, but I donot know how to apply these functions I donot the basic concept, how xmin and ymin value are chosen from thousands of values image have.
  댓글 수: 2
Guillaume
Guillaume 2015년 4월 30일
What do you call xmin and ymin of an image?
Manpreet
Manpreet 2015년 5월 1일
Thomas sir, I got your point. Thanks a lot.
To know these cordinates after imcrop command type data = clipboard('pastespecial'); you will get all the four values
Giving an example
S = imcrop(I); %Crop an image You can crop the image which will appear in the figure window,here afetr selecting the area to be cropped, right click the mouse and click to copy position and then type the following code. data = clipboard('pastespecial');% Four values will be stored here

댓글을 달려면 로그인하십시오.

답변 (2개)

Thomas Koelen
Thomas Koelen 2015년 4월 30일
xmin is the x coordinate of the lower left corner of the cut you want to make in the image,
ymin is the y coordinate of the lower left corner of the cut you want to make in the image,
width is the width of the cut you want to make,
height is the height of the cut you want to make.
  댓글 수: 1
Harold Getenga
Harold Getenga 2017년 12월 12일
I am more of a newbie in Matlab,but I would think since the spatial co-ordinates in Matlab are given from top-to-bottom for the y-axis, then that would make the ymin to be (at least visually) the y-co-ordinate of the top left corner of the cut you want to make.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2015년 5월 1일
Why don't you just call imcrop() with no input arguments and interactively make your cropping box?
  댓글 수: 2
fatima-zahra achbah
fatima-zahra achbah 2017년 10월 25일
But I need coordination of the cropped image, I need to know xmin ymin ... after cropping it
Image Analyst
Image Analyst 2017년 10월 25일
Documentation says
[___,rect2] = imcrop(_) returns the cropping rectangle in rect2, a four-element position vector, in addition to the cropped image.
So, did you actually supply a second output argument, rect, when you called it? My guess is no. So why don't you do that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by