lama icon indicating copy to clipboard operation
lama copied to clipboard

Proposal for the handling of B&W images

Open lcipolina opened this issue 4 years ago • 2 comments

Hello! Thank you for this fantastic model.

I am using it with Black and White images (i.e. gray) which only have 2 channels. Your code reads images using matplot lib, which will only read the 2 channels of an BnW image.

It will be better to read images using openCV, which adds the extra channel.

So replacing everything that reads the image like this:

img = plt.imread(fname)[:,:,:3] #this won't work in BnW

by using:

img = cv2.imread(fname) #this adds the extra channel and converts to np array on the fly

I can make the changes in your code and crete a pull request if you want.

Cheers, Lucia.

lcipolina avatar Dec 27 '21 11:12 lcipolina

Hello!

Thank you for appeciacion of our model and interest in our research!

Please feel free to create a pull request.

What's your impression of the performance of LaMa in B&W domain btw?

cohimame avatar Dec 27 '21 15:12 cohimame

Hi! Could you please point to the places we use plt.imread? I do no see any in our main code

windj007 avatar Jan 19 '22 10:01 windj007