現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
How can I create a .mat file in which I store the colour images and the corresponding histograms?
4 ビュー (過去 30 日間)
古いコメントを表示
I want to create the .mat file in which I need to store the Colour images and corresponding each colour image I need to store 4 histograms in row form. Can any one help me with code how to store color image and corresponding histogram in row form?
1 件のコメント
採用された回答
Image Analyst
2014 年 3 月 5 日
Make a 2D array of 1024 column by 50 rows
output = zeros(totalNumberOfImages, 1024); % Initialize
for imageNumber = 1 : totalNumberOfImages
% Compute the 4 histograms...
% Now save them
output(imageNumber, :) = [count1, count2, count3, count4];
end
do for all images, then save output (or whatever you want to call it) to a mat file
save(matFullFileName, 'output');
57 件のコメント
radha
2014 年 3 月 5 日
I have tried your code but I am getting error. So tell me where I went wrong. I want to also store the color image along with 4 histograms. So tell me how to do that? Currently for checking I have Used 5 as the count instead 50. The code is as below:
output = zeros(5, 1024); % Initialize
for imageNumber = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(imageNumber),'.jpg'));
Image=imresize(Image,[256 256]);
count1=LRBP(1,Image); %1st Histogram
count2=LRBP(4,Image); %2nd Histogram
count3=LRBP(16,Image); %3rd Histogram
count4=LRBP(64,Image); %4th Histogram
% Now save them
output(imageNumber, :) = [Image,count1, count2, count3, count4];
end
save('Hmat.mat', 'output');
Error is as follow:
??? Subscripted assignment dimension mismatch.
Error in ==> Hist_mat_t1 at 11 output(imageNumber, :) = [count1, count2, count3, count4];
??? Subscripted assignment dimension mismatch.
Error in ==> Hist_mat_t1 at 13 output(imageNumber, :) = [count1, count2, count3, count4];
??? Error using ==> horzcat CAT arguments dimensions are not consistent.
Error in ==> Hist_mat_t1 at 13 output(imageNumber, :) = [Image,count1, count2, count3, count4];
radha
2014 年 3 月 5 日
Sorry but I am not getting this point: How in .matfile all images and 4 histograms will be saved since we are creating it after the for loop, so it will store the image and histograms of the last image in .matfile??? I mean while running entire for loop all computation will be performed but only single image and its 4 histograms will be saved in .mat file. So please explain me this. Please help me for understanding this.
Thanks a loot!! Image Analyst please resolve my error.
Image Analyst
2014 年 3 月 5 日
You stuck image at the front, which is a 256x256 array. You can't stitch it horizontally with a 5x1024 array because the numbers of rows don't match. Why do you want to store the image in the mat file anyway? If you did, you'd have to do Image(:) to get it into a row vector, but I don't recommend it since you already have the images stored on disk. If you want you can store the filenames in the same mat file with a different variable name.
radha
2014 年 3 月 5 日
I will accept the answer once i will get my error resolved... Please reply. I am waiting for your response, Because you have answered my answer till this so i have hope of getting my work done. Thank you very much.................................................!!!!!!!!!!
Image Analyst
2014 年 3 月 5 日
Just don't save the images, like I said. I'll be in a meeting with the Mathworks people for the next 2 hours so I won't reply until after that.
radha
2014 年 3 月 6 日
Sorry!! I just Cleared my doubt today. So i don't need to store image in .matfile. It was my misunderstanding. But tell me what should I do to resolve the error which i told you yesterday. How should I modified your code so that i won't get that sunscripted dimension mismatch error. Thanks for your response. I was online when I commented yesterday your comments delivered late. Thanks!!! Please guide me.
radha
2014 年 3 月 6 日
編集済み: radha
2014 年 3 月 6 日
And I want to understand that we are saving output in .matfile at the end of the for loop so in .matfile there will be only last 4 histograms of image will be there?? This is what i interpreting from your code. So please clear my this doubt how 4 histograms of all images will be stored in .matfile. Please help!! I don't have much knowledge of matlab so i m asking. Thanks in advance!!!
Image Analyst
2014 年 3 月 6 日
Why do you say that? Notice that output has totalNumberOfImages rows, so every row in the matrix is 1024 elements long, which is the 4 histograms. So you will have every image's histograms in there, not just the last one.
You will not have that error anymore if, like I recommended, you do not try to save "Image" in the row.
radha
2014 年 3 月 7 日
編集済み: radha
2014 年 3 月 7 日
Image Analyst still I am getting this error. I don't know why? ??? Subscripted assignment dimension mismatch.
Error in ==> Hist_mat_t1 at 12 output(imageNumber, :) = [count1, count2, count3, count4];
Check and tell me where I should make change??
output = zeros(5, 1024); % Initialize for imageNumber = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(imageNumber),'.jpg'));
count1=LRBP(1,Image); %1st Histogram
count2=LRBP(4,Image); %2nd Histogram
count3=LRBP(16,Image); %3rd Histogram
count4=LRBP(64,Image); %4th Histogram
% Now save them
output(imageNumber, :) = [count1, count2, count3, count4];
end
save('Hmat.mat', 'output');
Image is being resized into 256X256 by the function LRBP which returns the histogram. Guide me. Thanks for response!!!!!
Image Analyst
2014 年 3 月 7 日
You might need to transpose the counts. Here, try this code:
%----------------------------------------------------------
% Program to read in all the images in a folder and
% display the histograms.
%----------------------------------------------------------
clc; % Clear command window.
close all; % Close all figure windows except those created by imtool.
workspace; % Make sure the workspace panel is showing.
fontSize = 16;
% Read in standard MATLAB color demo images.
% Construct the folder name where the demo images live.
imagesFolder = fullfile(matlabroot, '\toolbox\images\imdemos');
if ~exist(imagesFolder, 'dir')
% That folder didn't exist. Ask user to specify folder.
message = sprintf('Please browse to your image folder');
button = questdlg(message, 'Specify Folder', 'OK', 'Cancel', 'OK');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(button, 'Cancel')
return;
else
imagesFolder = uigetdir();
if imagesFolder == 0
% Exit if uer clicked Cancel.
return;
end
end
end
% Read the directory to get a list of images.
filePattern = [imagesFolder, '\*.jpg'];
jpegFiles = dir(filePattern);
filePattern = [imagesFolder, '\*.tif'];
tifFiles = dir(filePattern);
filePattern = [imagesFolder, '\*.png'];
pngFiles = dir(filePattern);
filePattern = [imagesFolder, '\*.bmp'];
bmpFiles = dir(filePattern);
% Add more extensions if you need to.
imageFiles = [jpegFiles; tifFiles; pngFiles; bmpFiles];
% Bail out if there aren't any images in that folder.
numberOfImagesProcessed = 0;
numberOfImagesToProcess = length(imageFiles);
if numberOfImagesToProcess <= 0
message = sprintf('I did not find any JPG, TIF, PNG, or BMP images in the folder\n%s\nClick OK to Exit.', imagesFolder);
uiwait(msgbox(message));
return;
end
% Create a figure for our images.
figure;
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
set(gcf,'name','Image Analysis Demo','numbertitle','off')
% Initialize array to hold the 4 histograms for all images.
output = zeros(numberOfImagesToProcess, 1024);
% Loop though all images, calculating and displaying the histograms.
% and stitching them together.
for k = 1 : numberOfImagesToProcess
% Read in this one file.
baseFileName = imageFiles(k).name;
fullFileName = fullfile(imagesFolder, baseFileName);
grayImage = imread(fullFileName);
% If we get to here, it's a true color image.
subplot(1, 2, 1);
imshow(grayImage, []);
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
grayImage = grayImage(:, :, 2); % Take green channel.
end
% Create a title for the image.
caption = sprintf('Original Color Image\n%s\n%d rows by %d columns by %d color channels', ...
baseFileName, rows, columns, numberOfColorBands);
% If there are underlines in the name, title() converts the next character to a subscript.
% To avoid this, replace underlines by spaces.
caption = strrep(caption, '_', ' ');
title(caption, 'FontSize', fontSize);
drawnow; % Force it to update, otherwise it waits until after the conversion to double.
subplot(1, 2, 2);
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
subplot(1, 2, 2);
bar(grayLevels, pixelCount);
grid on;
title('Histogram of original image', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.
% Get the histogram of the 4 quadrants.
midRow = floor(rows/2);
midCol = floor(columns/2);
quadrant1 = grayImage(1:midRow, 1:midCol);
quadrant2 = grayImage(1:midRow, midCol+1:end);
quadrant3 = grayImage(midRow+1:end, 1:midCol);
quadrant4 = grayImage(midRow+1:end, midCol+1:end);
% Let's compute the 4 histograms.
[pixelCount1, grayLevels1] = imhist(quadrant1);
[pixelCount2, grayLevels2] = imhist(quadrant2);
[pixelCount3, grayLevels3] = imhist(quadrant3);
[pixelCount4, grayLevels4] = imhist(quadrant4);
% Stitch together and stick into one row of the array.
output(k,:) = [pixelCount1', pixelCount2', pixelCount3', pixelCount4'];
% Prompt user to continue, unless they're at the last image.
if k < numberOfImagesToProcess
promptMessage = sprintf('Currently displaying image #%d of a possible %d:\n%s\n\nDo you want to\nContinue processing, or\nCancel processing?',...
numberOfImagesProcessed, numberOfImagesToProcess, baseFileName);
button = questdlg(promptMessage, 'Continue?', 'Continue', 'Cancel', 'Continue');
if strcmp(button, 'Cancel')
break;
end
end
end
save('AllHistograms.mat', 'output');
radha
2014 年 3 月 8 日
I ran your code it is working fine. According I changed your previous code and tried to run it but now it is giving me error for the function LRBP which returns the histogram. The modified code is:
clc; clear all;
output = zeros(5, 1024); % Initialize
for k = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(k),'.jpg'));
[pixelCount1, grayLevels1] = LRBP(1,Image);
[pixelCount2, grayLevels2] = LRBP(4,Image);
[pixelCount3, grayLevels3] = LRBP(16,Image);
[pixelCount4, grayLevels4] = LRBP(64,Image);
% Stitch together and stick into one row of the array.
output(k,:) = [pixelCount1', pixelCount2', pixelCount3', pixelCount4'];
end
save('Hmt.mat', 'output');
Error is as follows:
??? Error using ==> LRBP Too many output arguments.
Error in ==> ImT at 8 [pixelCount1, grayLevels1] = LRBP(1,Image);
Since LRBP is LBP on radon transform so I am applying radon transform on each block of the divided image then applying LBP on each block so corresponding to each block I have the histogram and I am merging this histograms by your code for that and getting final histogram. So LBBP is that histogram (After concatenating). I am displaying the Output of the LRBP as follow (All 4 Histogram output)
HP0 Columns 1 through 6
6545 111 320 524 18108 2543
Columns 7 through 12
3838 265 2556 1352 2242 103
Columns 13 through 18
470 3913 2404 1380 261 465
Columns 19 through 24
16803 154179 4381 2827 18119 2557
Columns 25 through 30
3921 154374 16694 440 252 319
Columns 31 through 36
526 19479 164429 4241 2761 15377
Columns 37 through 42
2549 3835 164116 19261 541 334
Columns 43 through 48
1357 2250 4231 531 60 2396
Columns 49 through 54
1383 2766 336 4396 2842 15384
Columns 55 through 59
434 252 67 266472 12799
HP1 Columns 1 through 6
5766 270 456 809 10294 2770
Columns 7 through 12
5486 379 2715 2516 6567 202
Columns 13 through 18
761 5696 7543 2908 381 770
Columns 19 through 24
18712 157844 6537 2566 10294 2714
Columns 25 through 30
5722 157983 18377 724 393 448
Columns 31 through 36
805 20762 153522 6158 2874 7580
Columns 37 through 42
2764 5477 153369 20405 843 532
Columns 43 through 48
2516 6553 6115 842 212 7582
Columns 49 through 54
2930 2863 526 6566 2567 7620
Columns 55 through 59
726 395 191 270377 10781
HP2 Columns 1 through 6
14345 753 1357 2688 15469 6229
Columns 7 through 12
18696 1241 6074 10153 53354 718
Columns 13 through 18
2694 19061 55329 12662 1243 2696
Columns 19 through 24
41412 341309 22786 5810 15475 6060
Columns 25 through 30
19042 341332 40599 2604 1291 1349
Columns 31 through 36
2677 42217 336512 22330 6033 9051
Columns 37 through 42
6206 18692 336528 41578 2686 1333
Columns 43 through 48
10130 53304 22295 2684 784 55376
Columns 49 through 54
12701 6003 1313 22761 5802 9024
Columns 55 through 59
2618 1296 820 645945 25360
HP3 Columns 1 through 6
30102 5085 3555 9899 15312 10839
Columns 7 through 12
56317 3325 9843 30269 276993 5140
Columns 13 through 18
9330 52878 280861 37572 3339 9358
Columns 19 through 24
87419 657504 63104 6715 15320 9842
Columns 25 through 30
52869 657527 85750 8151 2718 3541
Columns 31 through 36
9897 91631 666777 66487 7780 5495
Columns 37 through 42
10836 56282 666817 89944 8631 2813
Columns 43 through 48
30260 277076 66507 8648 5273 280846
Columns 49 through 54
37589 7777 2813 63122 6720 5492
Columns 55 through 59
8166 2704 5110 1307816 49847
>> SO Now what should I do??? since I am getting output of LRBP histograms as above. I tried using imhist on the LRBP histogram but it makes all the values to zero and only last values has some number. So I can't use imhist.
Thanks Image analyst for your continual support but again im stucked. So please guide me.
Thanks!!!!!!!!!
Image Analyst
2014 年 3 月 8 日
Put the cursor in LRBP and type control-d and tell me what the function line says. It might look something like
function [out1, out2] = LRBP(input1, input2)
but it probably looks like
function out1 = LRBP(input1, input2)
and provides only 1 output but you are expecting it to provide 2 outputs.
radha
2014 年 3 月 8 日
Means I should type control-d in command prompt after putting cursor in LRBP function???
radha
2014 年 3 月 8 日
I m not getting where to type control-d. I tried on command prompt but it gives me error. No such variable. And in the file of the LRBP but nothing happens. So please explain how to do that so that I can check what you want and let you know.
WE can proceed further.
radha
2014 年 3 月 8 日
Sorry I asking Many questions but I m not getting it. Please reply. you have done lot for me.
Thanks a lot!!!!
Please fix this. This is last part of my project. Waiting for your Reply.....
Image Analyst
2014 年 3 月 8 日
Put the cursor right over the word "LRBP" in your text editor, then click. You will get a veritical blinking cursor between some letters of that word. Then type control-D or right click and select Open LRBP from the pop up context menu. It should bring you to LBRP source code. Then tell me how it's defined.
radha
2014 年 3 月 8 日
LRBP function I have created and defined. It takes the number of blocks as first input and image as second input. Then based on number of blocks given it divides the image into that number of blocks and apply radon transform on each block then lbp on that radon transform. Thus Each block has histogram which is then merged into single histogram. Basically I am using spatial pyramid with level 4 so level one has one grid i.e. entire Image, level 2 has 4 blocks, level 3 has 16 blocks, level 4 has 64 blocks. So there are 4 cases in LRBP ie. no_of_blocks = 1,4,16,64. thus corresponding to these 4 level I m storing these histogram(i.e. after merging histograms of all blocks) in .matfile. Hence 4 histograms. Source code is here:
function Hist = LRBP( no_of_block,Image )
%UNTITLED33 Summary of this function goes here
% Detailed explanation goes here
theta=0:360;
mapping=getmapping(8,'u2');
Image=imresize(Image,[256 256]);
%imshow(Image),figure;
[rows columns numberOfColorBands] =size(Image);
%64 Blocks
if no_of_block==64
blockSizeR = 35; % Rows in block.
blockSizeC = 35; % Columns in block.
wholeBlockRows = floor(rows / blockSizeR);
blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(rows, blockSizeR)];
wholeBlockCols = floor(columns / blockSizeC);
blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(columns, blockSizeC)];
if numberOfColorBands > 1
ca = mat2cell(Image, blockVectorR, blockVectorC, numberOfColorBands);
else
ca = mat2cell(Image, blockVectorR, blockVectorC);
end
plotIndex = 1;
numPlotsR = size(ca, 1);
numPlotsC = size(ca, 2);
for r = 1 : numPlotsR
for c = 1 : numPlotsC
%fprintf('plotindex = %d, c=%d, r=%d\n', plotIndex, c, r);
% Specify the location for display of the image.
%subplot(numPlotsR, numPlotsC, plotIndex);
% Extract the numerical array out of the cell
%Block = ca{r,c};
%imshow(Block); % Could call imshow(ca{r,c})
%[rowsB columnsB] = size(Block);
% Make the caption the block number.
%caption = sprintf('Block #%d of %d\n%d rows by %d columns', ... % plotIndex, numPlotsR*numPlotsC, rowsB, columnsB); %title(caption); %drawnow; % Increment the subplot to the next location.
plotIndex = plotIndex + 1;
end
end
%disp(ca);
%subplot(4, 6, 1);
%imshow(Image),figure;
%title('Original Image');
sumHist =lbp(radon(double(ca{1,1}),theta),1,8,mapping,'h');
for i=2:r
for j=2:c
sumHist=sumHist+lbp(radon(double(ca{i,j}),theta),1,8,mapping,'h');
end
end
Hist=sumHist;
end
%16 Blocks if no_of_block==16
blockSizeR = 70; % Rows in block.
blockSizeC = 70; % Columns in block.
wholeBlockRows = floor(rows / blockSizeR);
blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(rows, blockSizeR)];
wholeBlockCols = floor(columns / blockSizeC);
blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(columns, blockSizeC)];
if numberOfColorBands > 1 ca = mat2cell(Image, blockVectorR, blockVectorC, numberOfColorBands); else ca = mat2cell(Image, blockVectorR, blockVectorC); end
plotIndex = 1; numPlotsR = size(ca, 1); numPlotsC = size(ca, 2);
for r = 1 : numPlotsR for c = 1 : numPlotsC %fprintf('plotindex = %d, c=%d, r=%d\n', plotIndex, c, r); % Specify the location for display of the image. %subplot(numPlotsR, numPlotsC, plotIndex); % Extract the numerical array out of the cell %Block = ca{r,c}; %imshow(Block); % Could call imshow(ca{r,c}) %[rowsB columnsB] = size(Block); % Make the caption the block number. %caption = sprintf('Block #%d of %d\n%d rows by %d columns', ... % plotIndex, numPlotsR*numPlotsC, rowsB, columnsB); %title(caption); %drawnow; % Increment the subplot to the next location. plotIndex = plotIndex + 1; end end %disp(ca); %subplot(4, 6, 1); %imshow(Image),figure; %title('Original Image');
sumHist =lbp(radon(double(ca{1,1}),theta),1,8,mapping,'h');
for i=2:r
for j=2:c
sumHist=sumHist+lbp(radon(double(ca{i,j}),theta),1,8,mapping,'h');
end
end
Hist=sumHist;
end
%4 Blocks if no_of_block==4
blockSizeR = 200; % Rows in block.
blockSizeC = 200; % Columns in block.
wholeBlockRows = floor(rows / blockSizeR);
blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(rows, blockSizeR)];
wholeBlockCols = floor(columns / blockSizeC);
blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(columns, blockSizeC)];
if numberOfColorBands > 1 ca = mat2cell(Image, blockVectorR, blockVectorC, numberOfColorBands); else ca = mat2cell(Image, blockVectorR, blockVectorC); end
plotIndex = 1; numPlotsR = size(ca, 1); numPlotsC = size(ca, 2);
for r = 1 : numPlotsR for c = 1 : numPlotsC %fprintf('plotindex = %d, c=%d, r=%d\n', plotIndex, c, r); % Specify the location for display of the image. %subplot(numPlotsR, numPlotsC, plotIndex); % Extract the numerical array out of the cell %Block = ca{r,c}; %imshow(Block); % Could call imshow(ca{r,c}) %[rowsB columnsB] = size(Block); % Make the caption the block number. %caption = sprintf('Block #%d of %d\n%d rows by %d columns', ... % plotIndex, numPlotsR*numPlotsC, rowsB, columnsB); %title(caption); %drawnow; % Increment the subplot to the next location. plotIndex = plotIndex + 1; end end %disp(ca); %subplot(4, 6, 1); %imshow(Image),figure; %title('Original Image');
sumHist =lbp(radon(double(ca{1,1}),theta),1,8,mapping,'h');
for i=2:r
for j=2:c
sumHist=sumHist+lbp(radon(double(ca{i,j}),theta),1,8,mapping,'h');
end
end
Hist=sumHist;
end
if no_of_block==1 Hist=lbp(radon(double(Image),theta),1,8,mapping,'h'); end
end
radha
2014 年 3 月 8 日
I am implementing LRBP algorithm. So I declared function instead of copy pasting the code for each level of spatial pyramid for getting the merged histogram. So Now You say what went wrong. For dividing image into blocks code I have taken form matlab central only.
Thanks a lot for your support. Guide me. Thanks!!!!
Image Analyst
2014 年 3 月 8 日
Look how you defined it:
function Hist = LRBP( no_of_block,Image )
Notice there is only one single output . Now, look how you're calling it:
[pixelCount1, grayLevels1] = LRBP(1,Image);
You're expecting two outputs , not one! So what's called Hist inside LRBP gets assigned to pixelCount1 in the main program, but LRBP does not pass back any second argument so there is nothing to stuff into grayLevels1 . That's why it says there are too many output arguments. If you want grayLevels1, you need to pass something out that can be put into grayLevels1.
radha
2014 年 3 月 8 日
So what should I put there in grayLevels1??? OR I change it like this???
[pixelCount1]=LRBP(1,Image);
But this will have any impact on the output?? Sir, you suggest what should I do???
Image Analyst
2014 年 3 月 8 日
Just don't accept grayLevels. Or send it out. Either way. You don't need it in your calling code so I'd just leave it off when you call it.
pixelCount1 = LRBP(1,Image);
radha
2014 年 3 月 8 日
Sir, I tried using
[pixelCount1]=LRBP(1,Image);
But I am getting error of
??? Subscripted assignment dimension mismatch.
Error in ==> ImN at 14 output(k,:) = [pixelCount1', pixelCount2', pixelCount3', pixelCount4'];
So I need to pass something there in the grayLevels1.
So How I will get grayLevels1 value?? Guide me sir.
Thanks a Lott!!!! Guide.
Image Analyst
2014 年 3 月 8 日
You need to step though this in the debugger. Are all PixelCountn 1024 rows by 1 column wide arrays? If they're 1x1024 instead of 1024x1 then get rid of the transpose ' operator. What are the sizes of them? What is the value of k? Just go through the normal debugging steps.
radha
2014 年 3 月 8 日
Sir, I checked in workspace the values of pixelCounts these are of the size 1X59 so I removed transpose operator but it is giving again the same error.
??? Subscripted assignment dimension mismatch.
Error in ==> ImN at 14 output(k,:) = [pixelCount1, pixelCount2, pixelCount3, pixelCount4
];
radha
2014 年 3 月 8 日
Code is:
clc;
clear all;
output = zeros(5, 1024); % Initialize
for k = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(k),'.jpg'));
pixelCount1 = LRBP(1,Image);
pixelCount2 = LRBP(4,Image);
pixelCount3 = LRBP(16,Image);
pixelCount4 = LRBP(64,Image);
% Stitch together and stick into one row of the array.
output(k,:) = [pixelCount1, pixelCount2, pixelCount3, pixelCount4];
end
save('Hmtt.mat', 'output');
radha
2014 年 3 月 9 日
Image Analyst what should I do now?? How can I get the value of grayLevels1 in LRBP??? Since As I told you the above code is giving me error of subscripted dimension mismatch at the line below.....
??? Subscripted assignment dimension mismatch.
Error in ==> ImN at 14 output(k,:) = [pixelCount1, pixelCount2, pixelCount3, pixelCount4
though I removed transpose operator.
Please help me.
Thanks a lot!!!! But I don't know how to deal with this now. Why subscripted dimension ??
Else How should I modify LRBP so as it return two outputs...
Please help me to finish this work of .matfile.
Thanks in advance!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
radha
2014 年 3 月 9 日
Image Analyst I have tried by using grayLevles as output with the value = 59 in LRBP since 59 is total number of values in each LRBP histogram. code is:
clc;
clear all;
output = zeros(5, 1024); % Initialize
for k = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(k),'.jpg'));
[pixelCount1, grayLevels1] = LRBP(1,Image);
[pixelCount2, grayLevels2] = LRBP(4,Image);
[pixelCount3, grayLevels3] = LRBP(16,Image);
[pixelCount4, grayLevels4] = LRBP(64,Image);
% Stitch together and stick into one row of the array.
output(k,:) = [pixelCount1, pixelCount2, pixelCount3, pixelCount4];
end
save('H.mat', 'output');
??? Subscripted assignment dimension mismatch.
Error in ==> ImLast at 14 output(k,:) = [pixelCount1, pixelCount2, pixelCount3, pixelCount4];
Still I am getting the subscripted assignment mismatch error.
So sir, please guide how I should resolve this subscripted dimension mismatch error. Why subscripted dimension error is coming every time I run??
Please solve this error. Thanks sir!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thanks a lot!!!! Help me this last point of .matFile.
radha
2014 年 3 月 9 日
I will accept your answer please solve this error. I am waiting for your response.... Please help...............
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
radha
2014 年 3 月 9 日
Image Analyst I have understood now why I am getting subscripted dimension mismatch error.
Can you noe just help me to resolve small thing.
In case of imhist in your program working fine because the pixelCounts for them are displayed in this form. Given below....
1
2
3
4
5
like this.
And in case of LRBP pixelCounts are displayed like this:
columns 1 to 7
1 2 3 4 5
I this form.
That's Why I am getting subscripted dimension mismatch as error. This what I tried to find out cause of the error.
Now can you please help me to guide what should I change??
So that This error will be resolved.
radha
2014 年 3 月 9 日
Can you just tell me how to change pixelCounts display and saving method of the LRBP to be displayed and stored like imhist.
Then error will be resolved.
radha
2014 年 3 月 9 日
I am on the way of completion.
Please help.
Thanks!!! Please reply I am in tension.
Please..............................................
Image Analyst
2014 年 3 月 9 日
Can you attach any m-files and data needed to run your program? I might be able to get to it this afternoon.
radha
2014 年 3 月 9 日
yes sir!!! Sure.
I am attaching all the files needed to run my program. If you want then I can also send ppt of LRBP algorithm as well.
Thanks a lott.!!!!!! I am really thankful to you!!!!!
radha
2014 年 3 月 9 日
First I am attaching the LRBP then lbp and getmapping..
Then attaching the demo file for single image matching. I have to get the input sketch image by user then get LRBP histogram at each level and compare these sketch image histograms with the LRBP histograms of color image at each level stored in .matfile.
But currently since .matfile is not created so I n demo matching is performed with respect to single image. If match is found then display message saying person present in database otherwise not present. PMK is distance used for comparing the LRBP histograms at each level.
I am using CUHK database for sketch images and corresponding photo images for this project. Basically it is used when eye-witness is only proof. So sketch will be drawn by artist and it is given as input to my project then there is criminal database having the face photo which is used for matching sketch with photo if match found the disply that message if not then that message. For this I am implanting LRBP algorithm.
radha
2014 年 3 月 9 日
Images are not being uploaded because it is giving me error !!!
No more then 10 file upload..
Wait for 24 hours.
So I am not able to send you th sketch and photo images.
Image Analyst
2014 年 3 月 9 日
If it's going to be a ton of work then I won't be able to help. I'm expecting like 5 minutes or less to find the error and fix it. If it gets more involved than that then I will just have to pass. You can zip your files together into a single zip file.
radha
2014 年 3 月 9 日
Okay. I will zip and send you.
Sir I explained indetail so that you have idea of what I am doing.
All these files are needed for running the .matile code.
So I am attaching with the your code of .matfile which I stored in .m file along with all other files.
Thanks for your help!!! I hope my error will be resolved.!!!
Thanks a lot!!!!!!!!!!!!!!!!!!!!!!
radha
2014 年 3 月 9 日
Sir you only have to resolve my subscripted dimension error. Rest thing I know how to do it.
Sir the file name ImLast is the file where your code of the .matfile is there. To run this you will need three files LRBP,lbp and getmapping.No need to have PMK.
Sir just resolve my .matfile error in the file ImLast.m
Thanks A LOOTTT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
radha
2014 年 3 月 9 日
I is saying remove one or more files. So removed previously attached files.
Still not able to upload..
Error
radha
2014 年 3 月 9 日
Now uploaded successfully.........................
Sir Now as i explained you can use the file Imlast.m which in turn uses the LRBP,lbp and getmapping files. You here just need to use photo images only. So You can use any photo image.
Thanks a lot!!!!!!!!!!!!!!!!
radha
2014 年 3 月 9 日
Sir, will you now solve this and reply me the solution???
Because for this error I am totally dependent on you, since I have tried at my level best and no other helping me.
Please give me some positive response.
Thanks!!!!
Please reply me whatever you perform for this. So I can decide what should I do???
radha
2014 年 3 月 10 日
Sir, my intension is not to get every thing done by you. I have done 80% work. Only this last 20% work of .matfile is remaining.
So please just solve .matFile error.
Thanks!!!!!
Please give me response whether you are going to do or you don't have time.
Please reply. I am waiting sir........................
Thanks a lot!!!!!!!!!!!
Image Analyst
2014 年 3 月 10 日
Probably not until tomorrow night. If you solve it yourself earlier let me know so I don't waste my time.
radha
2014 年 3 月 10 日
Okay, sure sir....
I am trying my best....
Let see...
I will tell you if and only if I will succeed in solving it.
Otherwise you will have to help.
Thanks!!!!
radha
2014 年 3 月 10 日
Sir, can you just tell me whether we can store large values in the array created using zero. such large like 29366.
Because I thought due to this I am getting subscripted dimension mismatch. so
Just tell me can we store such large values in array of output created using zero????????????
Thanks!!!!!!!!!!!!!!!
radha
2014 年 3 月 10 日
Sir I tried you clear first thing Whether pixelCounts1 and pixelCounts2, etc.. It should have single value or it should be array.
Because I think if it should be single value then I am getting dimension mismatch error, since pixelCounts1,pixelCounts2, etc are returning 1X59 arry.
radha
2014 年 3 月 10 日
編集済み: radha
2014 年 3 月 10 日
Sir I tried small script as below..
clc;
clear all;
out=zeros(5,1024);
for i=1:5
out(i,:)=[1 2 3 4];
end
save('T.mat','out');
But for this I am also getting the dimension mismatch error. So how to solve this for small code.
I think there is error in the code.
what do you think sir????
Can we achieve the our aim for storing in row form .matfile with this code??? For imhist it is working fine. But why not for LRBP????
Please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Thank you sir!!!!!!!!!!!!!
radha
2014 年 3 月 10 日
Shall we able to solve this error???
Sir I tried but not able to solve.
I need to finish by this Friday.
So if we can't solve this then there is any other alternate way to store in row wise form.
If yes then tell me I will try that....
I tried a lot sir because deadline is near...
I have to complete this...
So please guide me....
thanks for your continual response!!!!!!
Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Image Analyst
2014 年 3 月 11 日
In out(i,:)=[1 2 3 4]; the right hand side needs to be 1024 elements long, not 4. If you have 4 histograms of 256 elements each, then it will be 1024 elements long.
radha
2014 年 3 月 11 日
Exactly I had not changed that 1024 that is why I was getting error. Because my histograms has only 59 values. So not getting done my .matfile.
Now it's working fine.
Sir I am bit late to share my happiness because I was running my entire project.
It is good news for me that I have completed my project. I am very happy.
I don't know how much to say thanks to you. Without your help of my project would not be completed within deadline.
Sorry I disturbed you lot....
But Thanks a Lottttttttttt Image Analyst!!!!!!!!!!!!!!
Now I am developing GUI.
Thanks again....
You played very important role for my project. I never forget your help. Because only this .matfile work was left and you helped me to do that.
Again Thanks a Loootttt!!!!!
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)