当前位置:网站首页>[image processing] pyefd.elliptic_ fourier_ How descriptors are used
[image processing] pyefd.elliptic_ fourier_ How descriptors are used
2022-07-24 21:23:00 【FrenchOldDriver】
Fourier descriptor , By means of Fourier series approximation , To approximate the representation of image contour .
The key input is contours, Image outline , Can pass opencv Function implementation of .
im = cv.cvtColor(input_imgs, cv.COLOR_BGR2GRAY)
_, thresh = cv.threshold(im, 254, 255, cv.THRESH_BINARY) #get binary
contours, hierarchy = cv.findContours(thresh,cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE )
The acquisition method of image contour is like the above code , Generally, it turns gray first , Get more binary, Send it to findContours Function .
Back to contours It's usually a four-dimensional vector , respectively 【 Number of contours , The number of contour points of the contour ,1, coordinate x and y】.
For each profile , Fourier descriptors can be used .
#!pip install pyefd
from pyefd import elliptic_fourier_descriptors, plot_efd, normalize_efd, reconstruct_contour
coeffs = []
for j in contours:
coeffs.append(elliptic_fourier_descriptors(np.squeeze(j, axis=1), order=10, normalize=True))
The dimension of each outline is 【 length ,1,2】, and elliptic_fourier_descriptors Can only handle 【 length ,2】 Data like this , So use np.squeeze().
Want to see the outline learned , It can be used plot_pyefd
plot_efd(coeffs[0])
order Is the number of images , It's also coeffs[0] The length of , And its corresponding width is always 4.
If you want to rebuild contour points :
points = reconstruct_contour(coeffs)
边栏推荐
- ECCV 2022 open source | target segmentation for 10000 frames of video
- Acwing 94. recursive implementation of permutation enumeration
- Go language pack management
- Brand new: the latest ranking of programming languages in July
- Day5: three pointers describe a tree
- CAD disable a button on the toolbar (WEB version)
- Summary of yarn capacity scheduler
- Baidu classic interview question - determine prime (how to optimize?)
- [feature construction] construction method of features
- [crawler knowledge] better than lxml and BS4? Use of parser
猜你喜欢

Generate self signed certificate: generate certificate and secret key

Codeforces Round #808 (Div. 2)(A~D)

From front-line development to technical director, you are almost on the shelf

Five digital transformation strategies of B2B Enterprises
![[feature construction] construction method of features](/img/5c/c240d9d742f37cbc52afecf15b2ad1.png)
[feature construction] construction method of features

Information system project manager must recite the core examination site (47) project subcontract

Drive subsystem development

Native applets are introduced using vant webapp

Baidu PaddlePaddle easydl helps improve the inspection efficiency of high-altitude photovoltaic power stations by 98%

rogabet note 1.1
随机推荐
C local functions and yield statements
climb stairs
[summary of Feature Engineering] explain what features are and the steps of feature engineering
[basic data mining technology] KNN simple clustering
Bring new people's experience
C # image template matching and marking
Overview and installation of scientific computing toolkit scipyscipy
Native applets are introduced using vant webapp
Leetcode skimming -- bit by bit record 017
Scientific computing toolkit SciPy image processing
Mysql database query is so slow. Besides index, what else can it do?
Es+redis+mysql, the high availability architecture design is awesome! (supreme Collection Edition)
Spark related FAQ summary
Understand MySQL index and b+tree in an easy to understand way (supreme Collection Edition)
Detailed explanation of ThreadLocal
MySQL docker installation master-slave deployment
What does software testing need to learn?
Is there any capital requirement for the online account opening of Ping An Securities? Is it safe
[jzof] 06 print linked list from end to end
CAD sets hyperlinks to entities (WEB version)