-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add layouts #1
Add layouts #1
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.
some quick stuff.
Is there anything in particular you want feedback-wise?
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.
First pass
// We know ptr will be valid asynchronously because we construct it on the | ||
// stack of main. In real code we might want to use a shared_ptr or | ||
// something | ||
return std::async([=] { |
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.
bold and daring of you
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.
Why so?
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.
Its implementation-defined, but I think std::async
usually launches a new thread, so its sort of doodoo. But there's no read/write sync on the data pointed to by ptr. I would guess your serial::Serial
interfaces do some of their own protection, calling into the same offset
could be weird?
src/map.cpp
Outdated
|
||
// Populate the Mat with the data from the array (scale from int to 8-bit | ||
// range) | ||
for (auto i = 0u; i < Width * Height; ++i) { |
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.
std::transform(
std::begin(grid),
std::end(grid),
img.begin<uchar>(),
[](auto grid_value) -> uchar
{
return static_cast<uchar>(std::clamp(16 * grid_value, 0, 255));
}
);
less loopy index-y, but you probably need grid.begin()
and grid.end()
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.
or i could do neither of those things
save/load from image
46c64f5
to
f1ce0d5
Compare
No description provided.