Image Processing, how do I create a draggable square cursor and to calculate avg and std of ROI

3 vues (au cours des 30 derniers jours)
Hello all, I'm working on a project that requires me to filter out an image and then create a pixel region square that will hoover over a particular region of interest of the resultant image. The image is corrupted with radiation and I need to observe a particular region of this image. I have performed the filtering and used the impixelregion function which creates a pixelregion rectangule and a default window to view the ROI for the pixels of an image. However, i need the pixelregion rectangule to be of square dimension rather than rectangular.Upon specifying the region of interest by the pixelregion square, I also need to calculate the average pixel intensity and standard deviation for that region, and for the output to be displayed on the bottom half of the the default window with the pixel values at the bottom of that window. I tried to manipulate the impixelregion but to no avail. If some were to be kind to assist me in this problem. I will be grateful
  2 commentaires
Image Analyst
Image Analyst le 5 Juin 2013
What do you mean by square cursor? Normally the cursor is an arrow but turns to crossed lines when using ginput(), or a spinning blue circle in Windows if you do this:
% Change mouse pointer (cursor) to a circle or the "wait" cursor as defined by your operating system.
% QUIRK: use 'watch' and you'll actually get your "wait" cursor,
% not a watch.
set(gcf,'Pointer','watch');
What does it mean to have a square cursor? You mean like the mouse cursor is a tiny little square shape?
Genus
Genus le 5 Juin 2013
I made an error, it should be a pixelregion square which hoovers over a specific region similar to the pixelregion rectangle which hoovers over a ROI. But in this case its a square rather than a rectangle. Thanks

Connectez-vous pour commenter.

Réponse acceptée

Sean de Wolski
Sean de Wolski le 5 Juin 2013
doc imrect
And look at its method createMask
  4 commentaires
Genus
Genus le 5 Juin 2013
To image analyst the manipulation you mentioned, should be done in the imrect function.Am i correct in that assesment? What if I hypothetically wanted to manipulate the impixelregion function as to make adjustments to the function that creates the pixelregion rectangle that is exhibited below, how would one manipulate this to obtain a square and also calculate the average and standard deviation. The function is exhibited from line 220 to 254 in the impixelregion function. thanks
function zoomOut(varargin)
min_zoom = getMinimumPixelRegionMag(scrollpanelAPI.getViewport(),hIm);
candidate_zoom = scrollpanelAPI.getMagnification() / 1.25;
if candidate_zoom >= min_zoom
scrollpanelAPI.setMagnification(candidate_zoom);
else
rect_pos = scrollpanelAPI.getVisibleImageRect();
image_rect = [im_xdata(1)-0.5, im_ydata(1)-0.5, im_xdata(2), im_ydata(2)];
rect_aspect_ratio = rect_pos(3) / rect_pos(4);
candidate_height = image_rect(3) / rect_aspect_ratio;
constrained_in_height = candidate_height > image_rect(4);
getCenterX = @(pos) mean([pos(1),pos(1)+pos(3)]);
getCenterY = @(pos) mean([pos(2),pos(2)+pos(4)]);
% If requested zoom is less than minimum zoom, rectangle is either
% constrained in width or constrained in height
if constrained_in_height
cx = getCenterX(rect_pos);
cy = getCenterY(image_rect);
else
cx = getCenterX(image_rect);
cy = getCenterY(rect_pos);
end
scrollpanelAPI.setMagnificationAndCenter(min_zoom,cx,cy)
end
end % zoomOut
end % createToolbar
Image Analyst
Image Analyst le 5 Juin 2013
I haven't used impixelregion() so I can't help you.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by