Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

sal2edge.m 808 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  1. data_root = '/home/liuj/dataset/DUTS/DUTS-TR/DUTS-TR-Mask';
  2. out_root = '/home/liuj/dataset/DUTS/DUTS-TR/DUTS-TR-Mask';
  3. lst_set = '/home/liuj/dataset/DUTS/DUTS-TR/train'
  4. index_file = fullfile([lst_set '.lst']);
  5. fileID = fopen(index_file);
  6. im_ids = textscan(fileID, '%s');
  7. im_ids = im_ids{1};
  8. fclose(fileID);
  9. num_images = length(im_ids);
  10. for im_id = 1:10
  11. id = im_ids{im_id};
  12. id = id(1:end-4);
  13. % img_path = fullfile(data_root, [id '.jpg']);
  14. % image = imread(img_path);
  15. gt = imread(fullfile(data_root, [id '.png']));
  16. gt = (gt > 128);
  17. gt = double(gt);
  18. [gy, gx] = gradient(gt);
  19. temp_edge = gy.*gy + gx.*gx;
  20. temp_edge(temp_edge~=0)=1;
  21. bound = uint8(temp_edge*255);
  22. save_path = fullfile(out_root, [id '_edge.png']);
  23. imwrite(bound, save_path);
  24. end
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...