-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Snapshot Routine #1465
New Snapshot Routine #1465
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Just my two cents on a few things.
const fimg = new fabric.Image(img); | ||
fimg.scale(imageRatio); | ||
|
||
canvas.setBackgroundImage(fimg); | ||
canvas.renderAll(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be curious to know if we still need this preparation code (and corresponding cleanup code).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They did help create a cleaner overlay between the camera image and the canvas in the background
format: 'png', | ||
backgroundColor: null, | ||
}) | ||
.split(',')[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this split be done in the back-end? It would make the API contract simpler: a full data URI instead of just the image payload. This way the back-end could also check that it's receiving the expected PNG mime type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great suggestion, I will make the necessary changes
|
||
canvas.setBackgroundImage(0); | ||
canvas.renderAll(); | ||
|
||
const filename = `${proposal}-${currentSampleName}.jpeg`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We send PNG and receive JPEG in return. It's a bit counter-intuitive. Is there a particular reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@walesch-yan, thats perhaps me who did something strange when I rebased on esrf-develop
. The code above: format: 'png'
should perhaps have been format: 'jpeg'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that was my mistake as I wrote the back-end code after the sending part and before the receiving part and did not pay attention to it in between sorry about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries!
@walesch-yan :), Ahh |
No problem, I will handle the rebase and thanks! :) |
b1e80f9
to
dde9b93
Compare
I made the suggested changes, the isort rebase and set the correct version of mxcubecore in |
Co-authored-by: marcus-oscarsson <[email protected]>
dde9b93
to
304ecd8
Compare
Aaand removed two more unused imports from |
Thanks ! |
This PR adds changes to use the new snapshot routine, that we proposed in mxcube/mxcubecore#1048 and removes the old routine. It works by sending the canvas drawings as overlay-image to the server, which send back the overlay on top of the currently polled image from the camera.
I will keep this as a draft, since the new routine is not yet merged into the main branch of mxcubecore