0

I have a mammographic image of size 1024 x 1024, and I have the center coordinates of the anomaly (338.314) and the radius (56) in pixels of the circle containing the anomaly. I desire to extract a region of interest of size 128 * 128 including the anomaly. I tried with

rect = [338-64,314-64,127,127]; 
crop = imcrop (img, rect) ;

but I obtien an ROI that does not contain the desired anomaly. any suggestions please.

  • 1
    Are you sure the 'system of reference' is correct? In Matlab a pixel located at a coordinate (1,1) is at the top left corner, so maybe you need to change the coordinates in rect accordingly. – Benoit_11 Sep 24 '14 at 13:07
  • 1
    Adding to @Benoit_11 's answer, the `(x,y)` co-ordinate assumes the **column** location is `x` and the **row** location is `y`. Also, the orientation of the image is `y`-down, meaning that positive values of `y` go down the `y`-axis, not up. – rayryeng Sep 24 '14 at 13:13
  • i think that the system of reference is correct, because this is a reference database, a lot of people work with it – user3127771 Sep 24 '14 at 13:49

1 Answers1

1

MATLAB's matrix indices are in (row,column) format, while rectangle's indices are usually in (x,y) format. This means that you probably need to swap the two first elements of rectangle.

rect = [314-64,338-64,127,127]; 
crop = imcrop (img, rect) ;
Shaked
  • 475
  • 1
  • 3
  • 12
  • @user3127771 - It has already been done. As you can see, the row and column co-ordinates have been flipped in comparison to what you see in your post. – rayryeng Sep 24 '14 at 14:21