您现在的位置:首页 >> 技术文章 >> MATLAB技术 >> 内容

MATLAB代做|FPGA代做|python代做-基于matlab从图形坐标转换图像源码程序

时间:2020-10-21 21:10:09 点击:

  核心提示:MATLAB代做|FPGA代做|python代做-基于matlab从图形坐标转换图像源码程序...
function pixeliZedScratchPad = plotCoordinatesToImagePixels(x_coordinates, y_coordinates, imageSize)
%PLOTCOORDINATESTOIMAGEPIXELS 

numberOfPoints = length(x_coordinates);
% make into an image by pixelization the coordinates 1st
x_min = min(x_coordinates);
x_max = max(x_coordinates);
y_min = min(y_coordinates);
y_max = max(y_coordinates);

% [use linspace]
% numberOfGratings = 200;
numberOfGratings = imageSize;
unpixelizedRange_x = linspace(x_min, x_max, numberOfGratings);
unpixelizedRange_y = linspace(y_min, y_max, numberOfGratings);

pixelized_x_range = 1:numberOfGratings;
pixelized_y_range = 1:numberOfGratings;

pixeliZedScratchPad = zeros(numberOfGratings, numberOfGratings);

% pixelized the delineating cooridinates
for i = 1:numberOfPoints      
        distances = abs(x_coordinates(i) - unpixelizedRange_x); % find closest distance
        min_distanceIndex = find(min(distances) == distances);
        min_distanceIndexFor_x(i) = min_distanceIndex(1,1); % if there is more than 1, choose 1
        
        distances = abs(y_coordinates(i) - unpixelizedRange_y); % find closest distance
        min_distanceIndex = find(min(distances) == distances);
        min_distanceIndexFor_y(i) = min_distanceIndex(1,1); % if there is more than 1, choose 1
end    

% % pixelized the centroid coordinates
% distances = abs(centreOfShape(1,1) - unpixelizedRange_x);
% min_distanceIndex = find(min(distances) == distances);
% min_distanceIndexFor_Centroid_x0 = min_distanceIndex(1,1); % if there is more than 1, choose 1
% distances = abs(centreOfShape(1,2) - unpixelizedRange_y);
% min_distanceIndex = find(min(distances) == distances);
% min_distanceIndexFor_Centroid_y0 = min_distanceIndex(1,1); % if there is more than 1, choose 1

% % pixelized the centre coordinates
% distances = abs(0 - unpixelizedRange_x);
% min_distanceIndex = find(min(distances) == distances);
% min_distanceIndexFor_x0 = min_distanceIndex(1,1); % if there is more than 1, choose 1
% distances = abs(0 - unpixelizedRange_y);
% min_distanceIndex = find(min(distances) == distances);
% min_distanceIndexFor_y0 = min_distanceIndex(1,1); % if there is more than 1, choose 1

% connect the dots [in the case that the points are insufficient]
%{
increasedNumberOfPoints = 800;  % [TO DO]: automate this param
methodsOfInterpolation = {'spline', 'pchip', 'linear'};
methodOfInterpolationChosen = char(methodsOfInterpolation(1));
pt = interparc(increasedNumberOfPoints,min_distanceIndexFor_x, ...
    min_distanceIndexFor_y, methodOfInterpolationChosen);
min_distanceIndexFor_x = round(pt(:,1));
min_distanceIndexFor_y = round(pt(:,2));
%}
increasedNumberOfPoints = numberOfPoints; % in the case that the points are sufficient
        
% mark the delineating pixels
for i = 1:increasedNumberOfPoints 
    pixeliZedScratchPad(min_distanceIndexFor_x(i), min_distanceIndexFor_y(i)) = 1;
end


% pixeliZedScratchPad(min_distanceIndexFor_Centroid_x0, min_distanceIndexFor_Centroid_y0) = 1; % mark the centroid pixel
% pixeliZedScratchPad(min_distanceIndexFor_x0, min_distanceIndexFor_y0) = 1; % mark the centre pixel relative to the plot

% invert it
pixeliZedScratchPad = ~pixeliZedScratchPad;

% plot right side up
pixeliZedScratchPad = pixeliZedScratchPad';
pixeliZedScratchPad = flipud(pixeliZedScratchPad);


end


联系:highspeedlogic

QQ :1224848052

微信:HuangL1121

邮箱:1224848052@qq.com

网站:http://www.mat7lab.com/

网站:http://www.hslogic.com/

微信扫一扫:

作者:图形坐标转换 来源:图形坐标转换
  • 您是如何找到本站的?
  • 百度搜索
  • Google搜索
  • 查阅资料过程中
  • 论坛发现
  • 百度贴吧发现
  • 朋友介绍
本站最新成功开发工程项目案例
相关文章
  • 没有相关文章
相关评论
发表我的评论
  • 大名:
  • 内容:
  • matlab代做|matlab专业代做|matlab淘宝代做|python人工智能代做|FPGA项目合作|C代做|C++代做(www.hslogic.com) © 2020 版权所有 All Rights Reserved.
  • Email:highspeed_logic@163.com 站长QQ: 1224848052

    专业代做/代写/承接、MATLAB、SIMULINK、FPGA项目、博士/硕士/本科毕业设计、课题设计、论文,毕业论文,Coursework、Eassy、Assignment