如何在圖像上繪製網格。它應該成爲該圖像本身的一部分。 它應該能夠在圖像本身上顯示一些行和列。可以指定行和列的行。其實我對一些研究論文討論關於圖像變形的結果感到鼓舞。其中一個鏈接是這樣的:http://www.hammerhead.com/thad/morph.html在matlab中,如何在圖像上繪製網格
6
A
回答
10
SO上有許多相關的問題,討論修改圖像的方法。以下是兩種一般方法:
1.直接修改圖像數據:我在my answer to this other SO question中討論這個。由於圖像數據可以是2-D or 3-D,因此您可以使用multidimensional indexing來修改原始圖像數據,並根據給定的行和列創建行。下面是一個變化,每10行和列的圖像中黑色的例子:
img = imread('peppers.png'); %# Load a sample 3-D RGB image
img(10:10:end,:,:) = 0; %# Change every tenth row to black
img(:,10:10:end,:) = 0; %# Change every tenth column to black
imshow(img); %# Display the image
現在在變量img
的圖像數據上有黑線,你可以將它寫入文件或做任何你想要的其他處理。
2.劇情圖像和線,然後轉動軸/圖到一個新的圖像:在zellus' answer的link to Steve Eddins' blog示出如何可以繪製的圖像,並添加行它的例子。但是,如果您想要保存或執行顯示的圖像的處理,則必須將顯示的圖像保存爲圖像矩陣。你如何能做到這已經在這些其他SO問題進行了討論:
3
Superimposing line plots on images來自博客'史蒂夫在圖像處理'有一個很好的例子,在圖像上疊加網格。
+0
謝謝,這是我看到的最簡單的例子。 – 2010-11-15 15:31:57
1
其實我看到這個問題,我自己做這個代碼後....代碼讀取圖像並繪製網格在圖像上每一個輸入參數
我希望它會做什麼好:)
觀看MATLAB代碼:
function [ imageMatdouble ] = GridPicture(PictureName , countForEachStep)
%This function grid the image into counts grid
pictureInfo = imfinfo(PictureName); %load information about the input
[inputImageMat, inputImageMap] = imread(PictureName); % Load the image
if (pictureInfo.ColorType~='truecolor')
warning('The function works only with RGB (TrueColor) picture');
return
end
%1. convert from trueColor(RGB) to intensity (grayscale)
imageMat = rgb2gray(inputImageMat);
%2. Convert image to double precision.
imageMatdouble =im2double(imageMat);
% zero is create indicated to black
height = pictureInfo.Height ;
width = pictureInfo.Width
i=1;j=1;
while (i<=height)
for j=1:width
imageMatdouble(i,j)=1;
end
j=1;
if (i==1)
i=i+countForEachStep-1;
else
i=i+countForEachStep;
end
end
i=1;j=1;
while (i<=width)
for j=1:height
imageMatdouble(j,i)=1;
end
j=1;
if (i==1)
i=i+countForEachStep-1;
else
i=i+countForEachStep;
end
end
imwrite(imageMatdouble,'C:\Users\Shahar\Documents\MATLAB\OutputPicture.jpg')
end
相關問題
- 1. 在2D圖像上繪製網格cocos3d
- 2. 繪製2D網格在MATLAB
- 3. 用Matlab在圖上繪製圖像
- 4. 如何在Silverlight中的網格上繪製圖像?
- 5. 繪製2D:在網格佈局圖上繪製網格圖
- 6. Matlab。如何繪製圖像
- 7. 在Octave/Matlab上繪製點圖像
- 8. 如何在Python中繪製網格圖?
- 9. 如何在圖像上繪製圖像?
- 10. 在matlab上,我如何繪製rgb圖像上的質心點?
- 11. 在Matlab中繪製網絡
- 12. MATLAB ::在MATLAB上的圖像(矩陣)上繪製數字
- 13. 在MATLAB中繪製極座標圖像
- 14. 在圖像中繪製矩形 - Matlab
- 15. 如何在matlab中繪製背景圖中的圖像
- 16. 如何在UIView上繪製網格
- 17. 如何使用matlab在圖像上繪製矩形?
- 18. Matlab - 如何在圖像上繪製縮放的數字
- 19. 如何在之前繪製的MATLAB圖上繪製數據點?
- 20. 如何在Matlab中繪製密度圖
- 21. 如何在MATLAB中繪製圖表?
- 22. R在地圖上繪製網格值
- 23. 如何在網頁上繪製2D網格或地圖?
- 24. 如何在Matlab中繪製3D網格(立方體)
- 25. 在PictureBox上繪製網格
- 26. 在MATLAB中的地圖上繪製點
- 27. 如何在MATLAB中的圖像中繪製同心圓?
- 28. 如何在MATLAB中的圖像中繪製三角形?
- 29. 如何在surfaceview上繪製圖像android
- 30. 如何在Plots.jl上繪製圖像?
我覺得'1.直接修改圖像數據'中的示例代碼稍微簡單一些。 「2.繪製圖像和線......」部分也有幫助。 – 2010-11-15 18:54:44