搜索

基于matlab从图形坐标转换图像


发布时间: 2022-11-24 20:49:00    浏览次数:30 次

一、部分源码

%usage_ImageToAndFromGraphCooridinates
% Caveat: center of plot may be required
close all; clear all; clc;
plotRowSize = 2;
plotColSize = 2;
plotIndex = 0;
lowerRangeX = -3;
upperRangeX = 3;
lowerRangeY = -3;
upperRangeY = 3;
inputFolder = 'outputFiles';
targetFile = 'pixeliZedScratchPad.mat';
targetFileName = strcat(inputFolder, '\', targetFile);
targetFile = whos('-file', targetFileName);
targetFileContents = load (targetFileName); % load map
load (targetFileName); % load contents
% [UM: for the time being we deal with BW, ie. 2 levels]
figure('Name', 'Image to coordinated graph', 'NumberTitle','off');
plotIndex = plotIndex + 1;
subplot(plotRowSize,plotColSize, plotIndex);
imshow(pixeliZedScratchPad, []);
title('Image');
% pixeliZedScratchPad = floor(pixeliZedScratchPad);
% image to graph coordinates
[plotCoordinates_x plotCoordinates_y] = mapPixelsToCoordinatedPlotGraph(pixeliZedScratchPad, ...
upperRangeX, lowerRangeX, lowerRangeY, upperRangeY);
% graph coordinates to image
imageSize = 200;
pixeliZedScratchPad_reconstructed = plotCoordinatesToImagePixels(plotCoordinates_x, plotCoordinates_y, imageSize);
plotIndex = plotIndex + 1;
subplot(plotRowSize,plotColSize, plotIndex);
plot(plotCoordinates_x, plotCoordinates_y, 'x');
title('Coordinated graph');
axis([lowerRangeX-1 upperRangeX+1 lowerRangeY-1 upperRangeY+1]);
grid on;
% imshow(uint8(pixeliZedScratchPad), []);
plotIndex = plotIndex + 1;
subplot(plotRowSize,plotColSize, plotIndex);
imshow(pixeliZedScratchPad_reconstructed, []);
title('Image constructed from graph coordinates');

二、仿真图

 

 B9

免责声明 基于matlab从图形坐标转换图像,资源类别:文本, 浏览次数:30 次, 文件大小:-- , 由本站蜘蛛搜索收录2022-11-24 08:49:00。此页面由程序自动采集,只作交流和学习使用,本站不储存任何资源文件,如有侵权内容请联系我们举报删除, 感谢您对本站的支持。 原文链接:https://www.cnblogs.com/matlabfpga/p/16916026.html