WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Speckle Größe über Autocorrelation

 

HansiHans
Forum-Anfänger

Forum-Anfänger


Beiträge: 34
Anmeldedatum: 10.11.14
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 02.12.2014, 15:23     Titel: Speckle Größe über Autocorrelation
  Antworten mit Zitat      
Hi Leute,

ich bin auf folgendes Programm gestoßen:
http://www.mathworks.com/matlabcent.....-size-via-autocorrelation
oder:
http://www.mathworks.com/matlabcent.....ion/content/SpeckleSize.m


Das ist auch genau das, wonach ich suche. Bei meinen Bildern funktioniert das aber leider nicht. Ich habe den Vertikalen Anteil erstmals aus dem Programm entfernt.
Genauso in der 1. Zeile
Code:
function [ HFWHM, HeSquared, HFitStats, VFWHM, VeSquared, VFitStats ] = SpeckleSize( SpeckleRGB )

habe ich nur noch HFWHM stehen.

Mein ganzes Programm sieht wie folgt aus:

Output:
Code:
n=61;
    for i=1:n,          %es werden 22 Images durchgezählt
   
    filename = ['Test_' num2str(i) '.bmp'];     %Ordner der Bilder auswählen,
                                                  %num2str(i) legt bei den Bildern die _1 _2 usw. an
 
    [Bild, colorMap] = imread(filename);          %Ändert Bild um, speichert es ab und liest es wieder ein  
    colormap(colorMap);
    colorbar;
    Raw_Img = ind2rgb(Bild, colorMap);
    imwrite(Raw_Img,'Ppapier.bmp');
    filename = ['Ppapier.bmp'];
    Raw_Img=imread(filename);
   
   
    E(i)=SpeckleSizeOrginal(Raw_Img);
    delete('Ppapier.bmp');
    end


hold on; plot (E, 'r');

xlabel('Image Number','FontSize',20)
legend ('SpeckleSize');
ylabel('a.u','FontSize',20)
title('SpeckleSize ','FontSize',14)



Funktion für Speckle Size:
Code:
function [HFWHM] = SpeckleSize( SpeckleRGB )

%By: Joel Sleppy
%jdsleppy [AT] wustl.edu
%July 23, 2009

%SpeckleSize determines the speckle size from an image using
%autocovariance.

%SpeckleSize takes as an input a H by W by 3 matrix of integer values
%between 0 and 255, where H is the height of the image, W is the width of
%the image, and the three values are the RGB values for each pixel. Its
%outputs are the FWHM and 1/e^2 (beam waist) values of Gaussian fits to two arrays
%generated by the sums of the normalized autocovariances of 1) all rows in
%the image and 2) all columns in the image. From the FWHM size or the 1/e^2
%size, these arrays tell you the horizontal and vertical speckle sizes.
%Also, it outputs goodness of fit statistics (such as R-squared).

%HFWHM is the horizontal speckle size per FWHM method, VeSquared is the
%vertical speckle size per 1/e^2 method, etc.

%The easiest way to obtain an RGB matrix is to use the image processing
%toolbox to open an image from file and use 'export to workspace.'

%This is adapted from Haibo Lin's University of Missouri Ph.D thesis,
%"Speckle Mechanism in Holographic Optical Coherence Imaging"

%NOTE: The function works best when the entire image is full of speckle
%with no long-range background (such as a Gaussian envelope).
%If this is the case, H and V will have a needle-like peak in the center
%with little fluctuation elsewhere. If the needle-like peak sits on top of
%a 'hill,' either limit your FWHM calculations to the needle-like peak or crop the
%image so it is full of uniform speckle (no extra black background). The 'hills'
%are caused by the function processing the Gaussian envelope (or 'speckle within speckle') as one
%large spot against the black background. See GaussianSubtractSpeckleSize
%if needed.

%NOTE: The fit is not very good if the adjusted R-squared value is not near
%one!  Check this after every run.

Raw_Img=SpeckleRGB;
Raw_Img=uint8(Raw_Img);

M=size(SpeckleRGB,1);       %height of area
N=size(SpeckleRGB,2);       %width of area
B=rgb2gray(SpeckleRGB);     %produces grayscale image (intensity map)
B=double(B);                %typecasts the values as doubles

E=B(1,:);                   %creates an array with the values of row 1
s=size(xcov(E));            %finds the size of the autocovariance array
D=zeros(s);                 %creates an empty array of size s
D=double(D);                %typecasts the values as doubles
for i=1:M;
C=B(i,:);
D=imadd(D,xcov(C,'coeff'));         %sums the xcov arrays for all rows into D
end;
H=(D/max(D));             %the finished horizontal product, H, is normalized

       

%H and V are fit to Gaussians and the speckle size is extracted from the
%fits.

helper1 = 1:size(H,2);


gauss1 = fittype('gauss1');                                      %sets up the Gaussian curve fitting
excludeLowH = excludedata(helper1',H','range',[.2,1]);           %excludes the noise from outside the speckle
optionsH = fitoptions(gauss1);
optionsH.Exclude = excludeLowH;                                  


[HFit] = fit(helper1',H',gauss1, optionsH);                        %performs the fits


%The SpeckleSize code technically does not find the FWHM and 1/e2 widths of
%the Gaussian fits, but rather the widths at which the Gaussians fall to
%values of .5 and 1/e^2.  This provides a better idea of the speckles size
%even when the Gaussians amplitude is not unity, as expected for a perfect
%fit of the normalized data, but can produce unexpected trends...

HFWHM = (2*(HFit.c1)*sqrt(-log(.5/(HFit.a1))));                  %FWHM values (Full width when the fit = .5)  

end



Hoffe mir kann jemand weiterhelfen und sagen an was das liegt.

Beste Grüße
Hans

Graph Auswertung.JPG
 Beschreibung:

Download
 Dateiname:  Graph Auswertung.JPG
 Dateigröße:  21.57 KB
 Heruntergeladen:  286 mal
Private Nachricht senden Benutzer-Profile anzeigen


HansiHans
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 34
Anmeldedatum: 10.11.14
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 08.12.2014, 16:17     Titel:
  Antworten mit Zitat      
kann niemand helfen?
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2025 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.