当前位置:网站首页>[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)
边栏推荐
- 怎么在中金证券购买新课理财产品?收益百分之6
- Codeforces Round #808 (Div. 2)(A~D)
- Native applets are introduced using vant webapp
- [record of question brushing] 16. The sum of the nearest three numbers
- Cloud native observability tracking technology in the eyes of Baidu engineers
- Application layer - typical protocol analysis
- Practical skills!!
- MySQL docker installation master-slave deployment
- Ch single database data migration to read / write separation mode
- [advanced data processing technology] data filtering, advanced data filling, initial and advanced data transformation
猜你喜欢

Information System Project Manager - Chapter 10 project communication management and project stakeholder management

A new UI testing method: visual perception test

Brand new: the latest ranking of programming languages in July

class file has wrong version 55.0, should be 52.0
![[advanced data processing technology] data filtering, advanced data filling, initial and advanced data transformation](/img/0c/70643343d73137926963013a4862d0.png)
[advanced data processing technology] data filtering, advanced data filling, initial and advanced data transformation

ma.glasnost.orika. MappingException:No converter registered for conversion from Date to LocalDateTime
![[jzof] 05 replace spaces](/img/af/62432e0d6310d575a54e9409da0c32.png)
[jzof] 05 replace spaces
![[feature construction] construction method of features](/img/5c/c240d9d742f37cbc52afecf15b2ad1.png)
[feature construction] construction method of features

Five digital transformation strategies of B2B Enterprises

Sword finger offer 15. number of 1 in binary
随机推荐
[feature selection] several methods of feature selection
ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)
Leetcode skimming -- bit by bit record 018
How do test / development programmers survive the midlife crisis? You can see it at a glance
How to gracefully realize regular backup of MySQL database (glory Collection Edition)
Press Ctrl to pop up a dialog box. How to close this dialog box?
[untitled]
class file has wrong version 55.0, should be 52.0
Teach you five ways to crack the computer boot password
How to set the allure test report
Baidu interview question - judge whether a positive integer is to the power of K of 2
How to learn automated testing? Can you teach yourself?
[basic data mining technology] exploratory data analysis
APR learning failure problem location and troubleshooting
Two methods of how to export asynchronous data
Summary of yarn Explorer
Codeforces Round #809 (Div. 2)(A~D2)
【MLFP】《Face Presentation Attack with Latex Masks in Multispectral Videos》
None of the most complete MySQL commands in history is applicable to work and interview (supreme Collection Edition)
Pychart tutorial: 5 very useful tips