Skip to content
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

Docs/Example of of logging jpeg data from C++ #6520

Closed
jleibs opened this issue Jun 7, 2024 · 0 comments · Fixed by #6874
Closed

Docs/Example of of logging jpeg data from C++ #6520

jleibs opened this issue Jun 7, 2024 · 0 comments · Fixed by #6874
Assignees
Labels
🌊 C++ API C/C++ API specific 📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples good first issue Good for newcomers

Comments

@jleibs
Copy link
Member

jleibs commented Jun 7, 2024

This is not very well documented at the moment.

Would be nice to have something similar to:

#include <rerun.hpp>

#include <fstream>
#include <vector>

int main() {
    const auto rec = rerun::RecordingStream("rerun_example_image");
    rec.spawn().exit_on_failure();

    auto path = "test.jpeg";

    std::ifstream source_file{path, std::ios::binary};
    auto length{std::filesystem::file_size(path)};
    std::vector<uint8_t> jpeg_data(length);

    // Parsing the jpeg header is out of scope
    const int HEIGHT = 300;
    const int WIDTH = 300;

    source_file.read(reinterpret_cast<char*>(jpeg_data.data()), static_cast<long>(length));

    rec.log("image", rerun::Image({HEIGHT, WIDTH, 3}, rerun::TensorBuffer::jpeg(jpeg_data)));
}

though including a helper for parsing the header would certainly make it a lot cleaner.

@jleibs jleibs added enhancement New feature or request 👀 needs triage This issue needs to be triaged by the Rerun team 📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples 🌊 C++ API C/C++ API specific and removed enhancement New feature or request 👀 needs triage This issue needs to be triaged by the Rerun team labels Jun 7, 2024
@jleibs jleibs changed the title Example of of logging jpeg data from C++ Docs/Example of of logging jpeg data from C++ Jun 7, 2024
@Wumpf Wumpf added the good first issue Good for newcomers label Jun 11, 2024
@emilk emilk closed this as completed in 15db658 Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific 📖 documentation Improvements or additions to documentation examples Issues relating to the Rerun examples good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants