我想将QR码放入qr code曲面图像中。 我在MATLAB中使用极性形式以获得弯曲的形状,但我不知道如何将我的QR码拟合到这个非方形图像中。
this is the curved shape that i generate by MATLAB using polar form
揍你!
答案 0 :(得分:1)
这是一个快速的“肮脏方法”
[QR, map] = imread ('qr.png'); % indexed image, so we need to also get the map
QR = ind2gray (QR, map); % convert to grayscale
QR = fliplr (QR); % x-axis moves rightwards, whereas angle t moves
% leftwards, therefore flip left-to-right
[r, t] = ndgrid (1 : size (QR, 1), 1 : size (QR, 2)); % rows as radius,
% columns as angle
t = mat2gray (t); % Normalize angle in [0,1] range
t = ((-t) * deg2rad (20)) - deg2rad (80); % Convert to [80,100] range
r = mat2gray (r); % similar approach for radius range
r = (r * 5) + 15;
X = r .* cos (t); % convert polar to cartesian
Y = r .* sin (t);
scatter (X(:), Y(:), 1, QR(:)) % plot each cartesian pair as a
% plot point of size 1, and colour
% taken from the QR matrix
colormap gray;
axis off;
结果:
答案 1 :(得分:0)