Hello,
I am trying to write a matlab code to calculate the area of a specific region of a jpeg image using pixel size. To do so, I have two user defined functions. Users select these points by clicking on the image. The coordinates are then stored. I need to then apply a 2D median filter to create a binary image. I then need to use something (probably a while loop?) to detect the intensity edge of the image. The cut off intensity value would be the mean intensity of the image at the second user defined clicking point plus or minus 2 standard deviations. Intensity values below would be those found in this region. Intensity values above this cut off value would indicate the border/edge of the intensity at that particular y value. Then, it would record the x value at which the intensity difference happened in an array and move on to the next y coordinate value until reaching the upper y-coordinate limit (defined by the user click).
After obtaining this array between points (x1, y1) and (x2, y2), the distance between point (x1, y1) and (xa,ya) would be calculated using the distance formula (sqrt((x2-x1)^2=(y2-y1)^2)) until the distance reached an arbitrary value of 20 pixels. The value at which the distance is 20 pixels would be defined as the radius. The image should then be rotated by an angle defined by tan-1(|Yradius-y1|/|Xradius-x1|), to place this radius on a horizontal line with the initial user defined click.
After rotation, the same iteration process to find the intensity should be done for the image in this newly rotated state, except with the initial array varying in the x direction, and edge detection in the y-direction. Because here I need to calculate the area, after reaching the differing (higher) intensity value, I will need to count the number of pixels it took to get to this newly defined edge (in both the positive and negative direction). This will be done for each x value between the range of x1 of the user defined click, and the new radius coordinate point X. Then, to get the total distance (number of pixels) at each x value, I must find the distance between the y values.
Would anyone be able to tell me how to do/start tackling this task? I’m kind of new at this MATLAB thing.
Thanks.