Open 3D-Lasers-Lab opened 5 months ago
This also happens when sending @bedready
Has to do with the fact the image is cached by the browser, I'm going to keep looking into this, see if I can find a solution.
This might also have to do with it being a previous version of octopi and not a current version if they are serving the images with the no caching tag in the recent versions
This is surely because of caching. Usually the easiest approach to get around this is adding a timestamp querystring to the end of the image URL. Maybe if we include that in the return response from the check_bed function that would do it.
something like
timestamp = datetime.datetime.now()
return {"bed_clear": similarity > match_percentage, "test_image": f"{COMPARISON_FILENAME}?{timestamp:%Y%m%d%H%M%S}, "reference_image": reference, "similarity": round(similarity, 4)}
Other option would be to append the timestamp on the js side here.
const test_url = 'plugin/bedready/images/' + response.test_image + '?' + Date.now();
I did find this stack overflow post earlier https://stackoverflow.com/questions/1077041/refresh-image-with-a-new-one-at-the-same-url that had the same suggestion that you provided for js. I did try that but it does not seem to work. One thing that I did notice was that the address of the image in the html did not change, this is my first time working in js so not exactly sure how it should work.
I did just try your python suggestion and that worked perfectly :) Thanks
I did change it a bit but I changed it to import time timestampurl = COMPARISON_FILENAME+"?t="+str(time.time()) return {"bed_clear": similarity > match_percentage, "test_image": timestampurl, "reference_image": reference, "similarity": round(similarity, 4)}
not sure how to format on github
Also huge thanks to you, I did finish modifying the plugin to support masking (I put it in the open issue where somebody requested it) and spent the day browsing forums and documentation and I swear over half of the forum posts had your name somewhere in them. I couldn't have finished my modifications without your help and the help that you have contributed to all over the different forums.
When doing multiple tests the test image never updates. See in the picture I attached how the match percent is out of range but the two images are basically the same. Steps to recreate: Take snapshot set reference image save Test reference Move the camera so the image will be different Test reference
the match percentage will change but the test image will be the same