# How to Convert Python program to Elixir code

**URL:** <https://forum.elixirforum.com/t/how-to-convert-python-program-to-elixir-code/51152>\
**Category:** Questions\
**Tags:** elixir-ls, evision\
**Created:** [October 19, 2022, 6:42am UTC](https://forum.elixirforum.com/t/how-to-convert-python-program-to-elixir-code/51152 "2022-10-19T06:42:41Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![cocoa](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cocoa/32/24625_2.png) [@cocoa](https://forum.elixirforum.com/u/cocoa)\
**Post date:** [November 2, 2022, 11:19am UTC](https://forum.elixirforum.com/t/how-to-convert-python-program-to-elixir-code/51152/10 "2022-11-02T11:19:16Z")

</div>

For question 1, Nx.slice can only slice a rectangular area for you. To get the puzzle, you can use `Evision.warpPerspective`. There is an example of this function, [evision/examples/warp\_perspective.livemd at main · cocoa-xu/evision · GitHub](https://github.com/cocoa-xu/evision/blob/main/examples/warp_perspective.livemd).

For question 2, there could be 2 possible reasons,

- perhaps you forgot to change the second parameter of `Evision.findContours/3` to `Evision.cv_RETR_EXTERNAL()`
- you will need to find the contour that has shape `{4, 1, 2}`. And based on the sample image, I guess you were following a blog post and if so, I think you missed some intermediate steps.

---

_[View the full topic](https://forum.elixirforum.com/t/how-to-convert-python-program-to-elixir-code/51152)._
