0

This reference API article about improfile specifies a few different ways to call it. I am intersted in using the the function improfile(I,xi,yi). The example on the same page specifies xi and yi as 1x4 vectors. On this question which I asked a few days ago, I was given similar sort of inputs for xi and yi.

The objective of my improfile call is to measure the intensity of the image through the very center (if the rectangle below was an image, the red line is where I want to measure the intensity profile).

enter image description here

Community
  • 1
  • 1
SDG
  • 2,260
  • 8
  • 35
  • 77
  • Your question is a bit vague can you clarify if you are trying to calculate the intensity of each image in the stack and compare it against the other stack or you are combining a stack of image using some function and calculating the intensity of the whole stack? the vectors x and y in improfile specifies the area in the image you wish to calculate intensity for. – GameOfThrows Feb 03 '16 at 09:18
  • @GameOfThrows I have added some clarification to the question – SDG Feb 03 '16 at 09:23
  • and you are asking how to specify the x and y coordinates to cover an area / line of pixels of the red line region? – GameOfThrows Feb 03 '16 at 09:28
  • @GameOfThrows yeah, I'm not sure as to how two equal line vectors make a single line vector when it comes to specifying `xi` and `yi` – SDG Feb 03 '16 at 09:41

1 Answers1

1

I'm still trying to understand what you are trying to ask, but from my basic understanding, I think this might be what you are after:

A = rgb2gray(YourImage);; %//convert to Greyscale for simplicity
xi = [1 size(A,2) size(A,2) 1]; 
yi = [ceil(size(A,1)/2), ceil(size(A,1)/2), ceil(size(A,1)/2 ),ceil(size(A,1)/2)] %//These x and y coordinates is the red line which you drew with a width of 1 pixel.

The xi and yi are basically your 4 corner coordinates, if you only need 2 coordinate (i.e you only need a line), set the 4 y coordinates to the same (for a horizontal line), or set your 4 x coordinates to the same for a vertical line.

improfile(A,xi,yi),grid on;

Result image

as you can see, the intensity of the border (which is black) and the the contrast to the red line.

GameOfThrows
  • 4,510
  • 2
  • 27
  • 44
  • would you elaborate as to why you chose those specific values for `xi` and `yi` – SDG Feb 03 '16 at 09:44
  • Yeah that clears it, let me just try this and answer back whether or not it works. The API wasn't very clear about the selection of the coordinates for `xi` and `yi`. – SDG Feb 03 '16 at 09:46
  • well, it is a presumed knowledge, just like Matlab's matrix indexing (i.e. A(1,2) - A(row,column) ) The Matlab coordinate system is similar A(x,y) x is the horizontal measurement and y is the vertical measurement. – GameOfThrows Feb 03 '16 at 09:51
  • I still don't understand why 4 coordinates are needed, twice over in the form of `xi` and `yi` – SDG Feb 03 '16 at 10:34
  • 4 coordinates for a square area on your image, each coordinate must have a x and y reading (which corresponds to your 4 pairs of values in the x and y vectors) - also note that it does not have to be square, but any shape (made using coordinates). – GameOfThrows Feb 03 '16 at 10:37
  • And there we go! I finally understand the concept of `xi` and `yi`. Thanks a lot! – SDG Feb 03 '16 at 14:03