logankilpatrick
logankilpatrick

Reputation: 14551

How to crop an image in Julia?

I current have some images which contain a border that I need to remove so that I can use those images for a computer vision ML project. How can I use Julia to crop the images and remove the border?

Upvotes: 0

Views: 281

Answers (1)

logankilpatrick
logankilpatrick

Reputation: 14551

In Julia, you can do the following:

using Images

img_source = testimage("lighthouse")
# where testimage is function from the `TestImages` package.

# You can then do the following:
new_img = img_source[100:200, 100:200]

where img_source[y1:y2, x1:x2] represents the coordinates of the subsection of the original image you want to use. You can read more about this in the Julia Images docs.

Upvotes: 3

Related Questions