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

3 ビュー (過去 30 日間)
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 件のコメント
Image Analyst
Image Analyst 2013 年 6 月 5 日
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 2013 年 6 月 5 日
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

サインインしてコメントする。

採用された回答

Sean de Wolski
Sean de Wolski 2013 年 6 月 5 日
doc imrect
And look at its method createMask
  4 件のコメント
Genus
Genus 2013 年 6 月 5 日
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 2013 年 6 月 5 日
I haven't used impixelregion() so I can't help you.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by