# How to or can we use Hu moment output or 7 points to change the style , position ,width and height of object

**URL:** <https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294>\
**Category:** Python\
**Tags:** face, imgproc, contrib\
**Created:** [March 22, 2021, 9:25am UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294 "2021-03-22T09:25:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mandal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mandal/32/1494_2.png) [@Mandal](https://forum.opencv.org/u/Mandal)\
**Post date:** [March 22, 2021, 9:25am UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294/1 "2021-03-22T09:25:43Z")

</div>

Hi.

I am using face\_landmark\_dtection model to find the different landmarks of the face. i successfully find the all landmarks and exact location of the landmarks.

Now i want to change the lips position like i want to open the lips for this purpose i store the the upper lips and lower lips landmark position in a list and using this list i get the centroid of both lips using

M = cv2.moments(thresh)

and pass the points to the huMoments = cv2.HuMoments(M) to get the hu moments 7 points. i want to use these 7 points to change the lips style and position like for open mouth and close mouth can it possible or if possible how i use these points to change lips shape or there is another option for this purpose.

Thanks in advance …

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [March 22, 2021, 1:07pm UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294/2 "2021-03-22T13:07:11Z")

</div>

what exactly do you want to do with the HuMoments ? please explain a bit more.

> [@Mandal](#):
>
> to get the hu moments 7 points.

those are not points at all, more features like ratios, angles and dimensions

also, what is inside your tresholded image ? note, that HuMoments only can process a single blob or contour

---

<div class="post-metadata">

**Author:** ![Mandal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mandal/32/1494_2.png) [@Mandal](https://forum.opencv.org/u/Mandal)\
**Post date:** [March 22, 2021, 1:55pm UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294/3 "2021-03-22T13:55:47Z")

</div>

i am trying to make lip sync. application in which user select a song and picture application move the lips according to the voice .

in my Humoment i pass the all land mark points or lips area as a picture .

---

<div class="post-metadata">

**Author:** ![Mandal](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mandal/32/1494_2.png) [@Mandal](https://forum.opencv.org/u/Mandal)\
**Post date:** [March 22, 2021, 1:58pm UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294/4 "2021-03-22T13:58:20Z")

</div>

@berak can we use these 7 feature like ratios,angles and dimensions to change object shape??

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [March 22, 2021, 2:40pm UTC](https://forum.opencv.org/t/how-to-or-can-we-use-hu-moment-output-or-7-points-to-change-the-style-position-width-and-height-of-object/2294/5 "2021-03-22T14:40:14Z")

</div>

you can use them to measure your shape.

to change the object shape, you have to move e.g the mouth keypoints

if you want to move actual image pixels, you’d need something far more advanced, like a [voronoi renderer, like here](https://github.com/opencv/opencv_contrib/blob/master/modules/face/samples/sample_face_swapping.cpp) or some tps/remap op or move the whole drawing to opengl, maybe

hmm, maybe you can use the moments for spline or animation controllers, who knows 😉
