limit the search for maximums to a specific region
Show older comments
Good morning,
I am writing because, as the title suggests, I need to limit the search for maximums in a specific region. What I have to do is basically obtain a specific section from an image to find the color spectrum and from this identify the peaks approximately from 1500 to 3000 pixels.
In the findpeaks tab I have not found anything that can do for me.
I turn to you hoping for constructive help.
Thanks in advance for the answers.
% % mostra imgrifpixelscaled
figure
imshow(imgrifassps)
% % cattura punti di riferimento; nota: considera 10mm, mantieniti al centro della figura e prendi il primo punto a sinistra e il secondo punto a destra, infine la sezione di riferimento assoluta e poi relativa
[x,y]=ginput(4);
% % crea sezione di riferimento assoluto
sezionerifass=imgrifassps(round(y(3)),:);
% % fitting sezione rif ass
[xData, yData]=prepareCurveData( [], sezionerifass );
ft=fittype( 'smoothingspline' );
opts=fitoptions( 'Method', 'SmoothingSpline' );
opts.SmoothingParam=0.001;
[fitresult,gof]=fit( xData, -yData, ft, opts );
% % crea variabile sezione di riferimento assoluto fittata
sezionerifassfit=fitresult(xData);
% % trova picchi sezione di riferimento assoluto fittata
[prifass,locsrifass]=findpeaks(sezionerifassfit,"MinPeakHeight",-100,"NPeaks",7);
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!