[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Maximum ROI within an ROI



Here is a problem which may be trivial for some of you IDL gurus. I will be
VERY grateful for any help, help, direction, or pointers.

Take 2 regions (ROIs) of an image: One outer ROI and one inner ROI. The
inner ROI fits entirely inside the outer. For example:

;inner ROI, call it oROI
ix = [100, 150, 150, 100, 100]
iy = [70, 70, 120, 120, 70]
;outer ROI, call it iROI
ox = [100, 200, 150, 150, 200, 200, 100, 100]
oy = [70, 70, 95, 120, 145, 170, 170, 70]

;and a simple image
image = dist(256)

tv, image              ;display the image
plots, ox, oy, /device ;display oROI
plots, ix, iy, /device ;display iROI

Now the problem: Search ONLY the sub-image inside the oROI and find:
1) The number N of possible positions where iROI fits inside the oROI.
2) The optimal ROI (call it maxROI) characterized by the largest
total(image(maxROI))/n_elements(iROI)
amongst all N possible iROI positions inside oROI. The average value of the
sub-image inside maxROI is the is highest of all N possible.

Thanks in advance.

Messon Gbah