Find image intensity and perform fitting - fminsearch

2 visualizaciones (últimos 30 días)
Anand Ra
Anand Ra el 28 de Abr. de 2022
Comentada: Anand Ra el 1 de Mayo de 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

Respuesta aceptada

Image Analyst
Image Analyst el 29 de Abr. de 2022
Editada: Image Analyst el 29 de Abr. de 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 comentarios
Image Analyst
Image Analyst el 29 de Abr. de 2022
You need to put a calibration standard in there, like an aluminum step wedge, so that you can calibrate gray level vs. thickness.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by