Moving ROI and calculating concentration in that ROI displaying real time on the figure
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to do following steps to perform on a image selected by the user
1)after reading the image, i want to create ROI ,
2) second step is to move the ROI such that i can see real time change in mean value enclosed by that ROI
3) third step , i would want to see the cordinates, mean value on the image figure itself so that i can save the necessary snapshot
Please help!!
I am not able to addlistener as it gives me error of not able to process hg handles.
my code :
[filename, pathname] = uigetfile({'*.png'});
inputimage=strcat(pathname, filename);
imshow(inputimage)
roi = [];
roi = drawfreehand;
roi = roi.get('Position');
conc = mean(mean(roi));
xlabel({conc,'(Concentration)'});
0 Commenti
Risposte (1)
Anshuman
il 23 Feb 2023
As per my understanding you are trying to calculate the concentration in a ROI while moving it but getting errors on adding listeners.
Here is an example how you can try to do it:
%set up listeners for ROI moving events
addListener(roi,'Moving ROI',@allevents);
% allevents callback function displays the previous position & the current position of the ROI
function allevents(~,evt)
evname= evt.EventName;
switch(evname)
case{'MovingROI'}
disp(['ROI moving previous position:' mat2str(evt.PreviousPosition)]);
disp(['ROI moving current position :' mat2str(evt.CurrentPosition)]);
end
end
You can add case inside switch block as per your need, but this is the basic procedure of adding listeners. If you are still getting errors, then please attach its screenshot also.
Hope it helps!
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!