-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
How can we simply rotate 90° a color frame ? #4395
Comments
@jan-robot , the SDK does not provide such functionality, but this is easily achievable with cv::transpose. |
You can add this class in your code
and just replace this line : Of course this is just a "visual trick" Maybe a more advanced texture class can be directly added in the standard "example.hpp" including some rotation parameter... This may be helpfull ... |
Hi,
I use a realsense D415 camera vertically.
I checked the examples provided, and I would like to do the same thing as "capture" but with a 90 ° rotation in the rendering. Is there a simple way to do that?
I'm trying to find more information on the internet but the only similar thing I found was: #3249
But it was only for the depth and I did not find it very useful ...
Thank you in advance.
Code used
`// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
#include "example.hpp" // Include short list of convenience functions for rendering
// Capture Example demonstrates how to
// capture depth and color video streams and render them to the screen
int main(int argc, char * argv[]) try
{
rs2::log_to_console(RS2_LOG_SEVERITY_ERROR);
// Create a simple OpenGL window for rendering:
window app(1280, 720, "RealSense Capture Example");
// Declare two textures on the GPU, one for color and one for depth
texture depth_image, color_image;
// Declare depth colorizer for pretty visualization of depth data
rs2::colorizer color_map;
rs2::hole_filling_filter hole_filling;
// Declare RealSense pipeline, encapsulating the actual device and sensors
rs2::pipeline pipe;
// Start streaming with default recommended configuration
pipe.start();
while(app) // Application still alive?
{
rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera
// For cameras that don't have RGB sensor, we'll render infrared frames instead of color
if (!color)
color = data.get_infrared_frame();
// Render depth on to the first half of the screen and color on to the second
depth_image.render(depth, { 0, 0, app.width() / 2, app.height() }); // I want this display rotated with 90 ° angle
color_image.render(color, { app.width() / 2, 0, app.width() / 2, app.height() }); // I want this display rotated with 90 ° angle
}
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
{
std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
`
The text was updated successfully, but these errors were encountered: