mlampros / OpenImageR

Image processing Toolkit in R
https://mlampros.github.io/OpenImageR/
57 stars 10 forks source link

First tried HOG_apply in OpenImageR on Windows 10, using binary Windows library #22

Closed ecoquant closed 2 years ago

ecoquant commented 2 years ago

Received following message:

X1<- HOG_apply(object="./", cells=3, orientations=6, threads=4)

error: Mat::init(): size is fixed and hence cannot be changed Error in list_2array_convert(tmp_lst) : Mat::init(): size is fixed and hence cannot be changed

Question is what is the maximum number of files that HOG_apply can be used with in a directory? I got it to work with 9 files, but when I tried 32 files I got the above message.

Windows 10 Pro build 19042.1288, R version 4.1.1.

mlampros commented 2 years ago

hi @ecoquant, is it possible that you add a reproducible example?

It seems that you use as 'object' parameter a directory of images. I used 40 image files as input and I receive no errors,


> res = HOG_apply(FOLDER_path, cells=3, orientations=6, threads=4)

time to complete : 0.01370692 secs 

> str(res)
List of 2
 $ files: chr [1:40] "10 (3rd copy).png" "10 (4th copy).png" "10 (5th copy).png" "10 (6th copy).png" ...
 $ hog  : num [1:40, 1:54] 0.00464 0.00464 0.00464 0.00464 0.00464 ...
ecoquant commented 2 years ago

I will determine the actual limit and may send example. That's contingent upon solving another problem: Understanding the format of output from HOG. I don't know if the vector is organized so orientation bins are adjacent and then these are grouped by cells, or some other order. I also don't know if bin contributions are weighted by gradient strength. I looked at SimpleCV but it is unhelpful.

The alternative is writing my own HOG-like based upon IMAGER in which case whatever HOG_apply does with numbers of files won't matter.

I am not using HOG for automatic discrimination but for understanding and manual discrimination.

Thanks for your efforts,

On Sun, Oct 17, 2021, 08:44 Lampros Mouselimis @.***> wrote:

hi @ecoquant https://github.com/ecoquant, is it possible that you add a reproducible example?

It seems that you use as 'object' parameter a directory of images. I used 40 image files as input and I receive no errors,

res = HOG_apply(FOLDER_path, cells=3, orientations=6, threads=4) time to complete : 0.01370692 secs str(res)List of 2 $ files: chr [1:40] "10 (3rd copy).png" "10 (4th copy).png" "10 (5th copy).png" "10 (6th copy).png" ... $ hog : num [1:40, 1:54] 0.00464 0.00464 0.00464 0.00464 0.00464 ...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mlampros/OpenImageR/issues/22#issuecomment-945112377, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASSJQQ6YPWRGJBJC4I34PI3UHLAMJANCNFSM5GEB47IQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mlampros commented 2 years ago

I've converted the SimpleCV python function to Rcpp in the OpenImageR package. Everything related to HOG can be seen in the OpenImageRheader.h file and especially in the lines 2211 to 2406 The function that will give an answer to your question about the orientation bins is the hog_cpp()

ecoquant commented 2 years ago

Thanks much for your help. However, I've decided for my purposes (studying changes in moss communities using digital photographs) direct access to the point gradient magnitudes and their directions is what I want. I don't want any discretization. For my purposes, that's throwing information away. By having access to the magnitudes and directions I can create a conceptual spectrum on -pi to +pi with the strengths of the gradients as amplitudes. And if I have two of those, I can compare them using all kinds of spectral comparison or density comparison techniques.