Performing Eulerian flow analysis on this problem

17 次查看(过去 30 天)
I am attempting to find the governing equation for the Position(x,y,t) and Orientation θ(x,y,t) of these pellets, which collectively behave as a fluid. To perform flow analysis and find governing equations for these pellets (which will be accordingly moved across by a conveyor belt):
I first attempted to do a Langrangian analysis of this problem, which required that I find every pellet and its position (Xi) and Angle/orientation relative to the horizontal (θi). However so I did it, I used MATLAB and python modules such as OpenCV, I was not able to segment all the pellets to even make this a possibility.
CODE I USED:
clear
function [BW,maskedRGBImage] = mymask(RGB)
%createMask Threshold RGB image using auto-generated code from colorThresholder app.
% [BW,MASKEDRGBIMAGE] = createMask(RGB) thresholds image RGB using
% auto-generated code from the colorThresholder app. The colorspace and
% range for each channel of the colorspace were set within the app. The
% segmentation mask is returned in BW, and a composite of the mask and
% original RGB images is returned in maskedRGBImage.
% Auto-generated by colorThresholder app on 01-Apr-2024
%------------------------------------------------------
% Convert RGB image to chosen color space
I = rgb2hsv(RGB);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.009;
channel1Max = 0.112;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.103;
channel2Max = 0.275;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.347;
channel3Max = 0.687;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
end
inpict = imread('test.png');
mk = mymask(inpict); % create a mask using global thresholds
mk = bwareaopen(mk,100); % get rid of a thousand tiny specks
S = regionprops(mk,'area');
CT = hsv(numel(S));
CT(2:2:end,:) = flipud(CT(2:2:end,:));
% the result is one giant conglomerate blob
% and several smaller conglomerate blobs
alpha = 0.8;
outpict = labeloverlay(inpict,bwlabel(mk), ...
'transparency',1-alpha,'colormap',CT);
imshow(outpict,'border','tight')
RESULT IMAGE FOR THE LANGRANGIAN ATTEMPT USING MATLAB:
Attempting to track all pellets as a function of time is simply too difficult for this problem. How can I use Eulerian analysis to find governing equations or field parameters for this problem?

回答(1 个)

Drishti
Drishti 2024-9-2
Hi Saye,
The Lagrangian approach deals with individual particles and calculates the trajectory of each particle separately, whereas the Eulerian approach deals with concentration of particles.
To perform ‘Eulerian Analysis’ on the provided ‘test.png’ image, one work around involves creating concentration fields using the ‘blockproc’ function. In this context, each block processed by the ‘blockproc’ function corresponds to a specific fixed spatial region within the image.
Refer to the following implementation code to create concentration fields:
% Calculate concentration field which is an aspect in eularian analysis
blockSize = [10, 10]; % Define block size for local concentration
concentrationField = blockproc(BW, blockSize, @(block) sum(block.data(:)));
% Normalize concentration
concentrationField = concentrationField / max(concentrationField(:));
% Visualization
figure;
imshow(concentrationField, []);
title('Concentration Field');
colormap('jet');
colorbar;
For better understanding, I have attached the image following eularian analysis using ‘blockproc’ work around.
For further information, refer to the MATLAB Documentation of the ‘blockproc’ function:
Hope this resolves the query.

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by