Effacer les filtres
Effacer les filtres

Find image intensity and perform fitting - fminsearch

1 vue (au cours des 30 derniers jours)
Anand Ra
Anand Ra le 28 Avr 2022
Commenté : Anand Ra le 1 Mai 2022
Hello,
I am looking to:
1. Extract intensity along the length of the medium ( xray scan) ( Not sure how)
2. Plot the intensity
3. And use fminsearch to fit the intenisty values in a wave propagation model to determine the constants in the model ( Not sure how)
providing the tiff image link,. since I am unable to upload here: https://ibb.co/cczb54D
My attempt is provided below. Kindly requesting help.
% Objective:
%{
1. Import a CT scan image( CT scan of an Cu wire)
2. Extract the intensity from the CT scan image(CT scan of an Cu wire) :
which will be the observed data
3. Define the exponential decay model describing the Wave propagation through a medium
4. Perform fminsearch to determine the constants ( imaginary constants)
in the decay model.
%}
clc; % Clear the command window.
close all; % Close all figures
format long g;
format compact;
%% Importing the CT scan/test image
% fullname = get_full_filename('20220422_5anglestep000.tif')
test_image = imread('test_image.tif');
imshow(test_image)
% Getting the dimensions of the image.
[rows, columns] = size(test_image);
%% Display histogram
imhist(test_image);
grid on;
title('Histogram of original test image')
%% Plotting intensities along Z axis
z1 = [0 size(test_image,2)];
y1 = [size(test_image,1)/2 size(test_image,1)/2];
c = improfile(test_image,z,y1);
%% Extracting the intensities from the medium
% Image represents the wave propgation through a medium in terms of
% intensity vs thickness(displacement) of the medium
% Looking to extract the intensity as a function of displacment from image
% z: displacement ( Z axis locations)
% wave_obs = intensity (Y axis)
%% Defining the equation wave = exp(i(1-del)k*z * exp(-beta)*z
%{
i - signifying imaginary part
z - array representing the length of the medium
k - refractive index
del - constant ( to be determined)
beta -constant ( to be determined)
%}
k=1.5;
%% fminsearch
wave_pred = fminsearch(wave_prediction);
predicted_wave = wave_pred(z,k);
function wave_prediction = wave_pred(z,k)
del =5;
beta =7;
k=1.5;
z= 0:0.2:20;
wave1 = exp(-1i*(1-del)*k*z);
wave2 = exp(-beta)*z;
wave_prediction = @(del,beta)wave1.*wave2;
end

Réponse acceptée

Image Analyst
Image Analyst le 29 Avr 2022
Modifié(e) : Image Analyst le 29 Avr 2022
You don't need improfile() if you want the intensity along a certain row, so instead of
c = improfile(test_image,z,y1);
do
middleRow = round(size(test_image, 1) / 2) % Find middle row.
c = test_image(middleRow, :) % Get all columns in the middle row.
% Now plot the intensity.
plot(c, 'b-', 'LineWidth', 2);
grid on;
xlabel('X Column');
ylabel('Gray Level');
  5 commentaires
Image Analyst
Image Analyst le 29 Avr 2022
You need to put a calibration standard in there, like an aluminum step wedge, so that you can calibrate gray level vs. thickness.
Anand Ra
Anand Ra le 1 Mai 2022
@Image Analyst Thank 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