Question: The following piece of code is given for recognizing hand - written digits. You are required to fill in the box which includes ?
The following piece of code is given for recognizing handwritten digits. You are required to
fill in the box which includes as given below so that you find moments based on the set of
input images. Then, the moments will be classified thanks to the piece of code which follows
the box.
and i dont want you to cheng any thing in the given Q you can cheng in this cod that i well send and Merge codes solve it wath this methoed
Moments
Image moments help you to calculate some features like center of mass of the object, area of the object etc. Check out the wikipedia page on Image Moments
The function cvmoments gives a dictionary of all moment values calculated. See below:
import numpy as np
import cv as cv
img cvimreadstarjpg cvIMREADGRAYSCALE
assert img is not None, "file could not be read, check with ospath.exists
ret,thresh cvthresholdimg
imcontours,hierarchy cvfindContoursthresh
cnt contours
M cvmomentscnt
print M
From this moments, you can extract useful data like area, centroid etc. Centroid is given by the relations, CxMM and CyMM This can be done as follows:
cx intMmMm
cy intMmMm
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
