How to save maximum level values in the array

조회 수: 4(최근 30일)
Stephen john
Stephen john 2022년 8월 15일
댓글: Stephen john 2022년 8월 15일
Hello every one, I hope you are doing well. I have the following code which take the data as input which has shape 1x77564 then we convert it into 1000 samples. So there are 80 images were created using the following Code.
Each 1000 samples is convert into image as shown in the following code. after converting into image , i have applied a function which finds the number of level, maximum,minimum value
I want to save the Values in image which have maximum number of levels, and PRFValue with respect to levels for example if maximum levels are 4 then number of PRFValue are 4 and find the maximum and minimum value from that.
buffered = buffer(incomingdata, 1000);
for K = 1 : size(buffered,2)
thisdata = buffered(:,K);
%work with thisdata
[numImages, lenImage] = size( outputdataset);
imSz = 1000; % assuming images are 1000x1000
imbg = false(10000,1000); % background "color"
imfg = ~imbg(1,1); % forground "color"
imSizeOut=[10000 1000]; % ImageSize
for k= 1:numImages
imData = round( outputdataset(k,:)); % get pattern
[~,Y] = meshgrid(1:1000,1:10000); % make a grid
% black and white image
BW = imbg;
% convert to uint8 (0 255)
valueestimationimage = im2uint8(valueestimation);
% resize (from 1000x1000)
% convert to uint8 (0 255)
imoriginalestimate = im2uint8(BW);
imoriginal = flipud(imoriginalestimate);
[PRFValue,NumberofPulses,Levels,maximum,minimum]= DSLEVELFUNCTION1(imoriginalestimate )
%DS Function
function [PRFValue,NumberofPulses,Levels,maximum,minimum]= DSLEVELFUNCTION1(path)
rgbImage = path;
[rows, columns, numberOfColorChannels] = size(rgbImage);
if numberOfColorChannels > 1
grayImage = rgbImage(:, :, 3);
grayImage = rgbImage;
mask = grayImage >= 128;
SE= strel('disk',2);
BW = imclose(mask,SE);
[labeledImage, numRegions] = bwlabel(BW);
props = regionprops(labeledImage,'all' );
allLengths = [props.Area];
% NumberofPulses=allLengths;
centroids = vertcat(props.Centroid);
whiteLineRows1 = centroids(:, 2);
DSPRFValue= unique(whiteLineRows1);
% figure;
% hold on;
for k = 1 : numRegions
y1 = round(centroids(k, 2));
y2 = y1;
xt = props(k).Centroid(1);
yt = props(k).Centroid(2);
BB = props(k).BoundingBox;
% str = sprintf('DS Length %d at PRF %d', size(props(k).Image,2), y1);
% text(xt, yt, str, 'Color', 'r', 'HorizontalAlignment', 'Center', 'VerticalAlignment','bottom', 'FontSize',8);
% rectangle('Position', [BB(1),BB(2),BB(3),BB(4)],'EdgeColor','b','LineWidth',1) ;
% caption = sprintf('Dwell and Swtich Image with %d Levels', Levels);
% hold off
% title(caption, 'FontSize',10);
  댓글 수: 12
Stephen john
Stephen john 2022년 8월 15일
@Walter Roberson Okay let say its one every time, then Please solve this method. When the image are created then we pass through the function , use the following line, Each image is pass through this function it returns PRFValue,NumberofPulses,Levels,maximum,minimum.
I want to save the matrix which have Highest number of Levels and save the corresponding PRFValue,NumberofPulses,maximum,minimum

댓글을 달려면 로그인하십시오.


Community Treasure Hunt

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

Start Hunting!

Translated by