Hi, please how can i place mosaic tiles at different angles. i want to convert a digital image into tile mosaic image using gradient vector flow(GVF) field method. The GVF field direction aids in tile positioning.

6 Ansichten (letzte 30 Tage)
Here is the algorithm:
1. Input: a raster image I
2. L(I) = Luminance(I)
3. G(I) = Robert’s Gradient(Equalize(L(I)))
4. [u, v] = GVF(|G(I)|1,μ, nIterations)
5. gvf(I) =(u2 +v2)^1/2
6. Sort in queue Q pixels (i, j) according to decreasing gvf (i, j) values. Only pixels whose gvf is greater than a threshold T go into Q.
7. while Q is not empty
8. Extract pixel P from Q
9. Place a tile in P at angle a = arctan(v(i, j)/u(i, j))
10. if in this way the tile overlaps with previously placed tiles
11. Skip tile positioning.
12. for j 1 to length(I)
13. for i 1 to width(I)
14. Place a tile in the pixel(i, j) at angle a = arctan(v(i, j)/u(i, j))
15. if in this way the tile overlaps with previously placed tiles
16. Skip tile positioning.
The code i have written so far
[I,map]= imread('taijitu sample remix 5.jpg');
[r,c,t]= size(I);
figure,imshow(I)
K = rgb2gray(I);
BW1 = edge(K,'roberts',0.03);
SE = strel('square',3);
BW2 = imdilate(BW1,SE);
SE1 = strel('square',3);
BW3 = imerode(BW2,SE1);
figure, imshow(BW3)
//code for algorithm line 4
[u1,v1]= GVF(BW3,0.2,80);
//code for algorithm line 5
gvf = sqrt(u1.^2 + v1.^2);
quiver(u1,v1,'r');
axis tight;
//code for algorithm line 6
T=0.35;
[Q]=(gvf>T);
C = sort(Q,'descend');
P= atan2d(v1,u1);
Here is the input image
The gradient vector field of the input image

Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by