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

Samples: Use new capture APIs #269

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ from the camera can be used.

- **Camera**
- **Basic**
- [Capture](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/Capture/Capture.cpp) - Capture point clouds, with color, from the Zivid camera.
- [Capture2D](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/Capture2D/Capture2D.cpp) - Capture 2D images from the Zivid camera.
- [CaptureAssistant](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureAssistant/CaptureAssistant.cpp) - Capture Assistant to capture point clouds, with color,
from the Zivid camera.
- [Capture](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/Capture/Capture.cpp) - Capture colored point cloud, save 2D image, save 3D ZDF,
and export PLY, using the Zivid camera.
- [CaptureFromFileCamera](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cpp) - Capture point clouds, with color, with the Zivid file
camera.
- [CaptureHDR](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureHDR/CaptureHDR.cpp) - Capture HDR point clouds, with color, from the Zivid
camera.
- [CaptureHDRCompleteSettings](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureHDRCompleteSettings/CaptureHDRCompleteSettings.cpp) - Capture point clouds, with color, from the Zivid camera
with fully configured settings.
- [CaptureWithSettingsFromYML](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cpp) - Capture point clouds, with color, from the Zivid camera,
with settings from YML file.
- [CaptureWithSettingsFromYML](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Basic/CaptureWithSettingsFromYML/CaptureWithSettingsFromYML.cpp) - Capture images and point clouds, with or without color,
from the Zivid camera with settings from YML file.
- **Advanced**
- [AllocateMemoryForPointCloudData](https://github.com/zivid/zivid-cpp-samples/tree/master/source/Camera/Advanced/AllocateMemoryForPointCloudData/AllocateMemoryForPointCloudData.cpp) - Two methods to copy point cloud data from GPU memory to
CPU memory, to be consumed by OpenCV.
Expand Down
4 changes: 2 additions & 2 deletions source/Applications/PointCloudTutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ compute device memory) and the capture and camera information.
When you capture with Zivid, you get a frame in return.

([go to
source](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/Capture/Capture.cpp#L22))
source](https://github.com/zivid/zivid-cpp-samples/tree/master//source/Camera/Basic/Capture/Capture.cpp#L25))

``` sourceCode cpp
const auto frame = camera.capture(settings);
const auto frame = camera.capture2D3D(settings);
```

Check
Expand Down
3 changes: 0 additions & 3 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ option(USE_HALCON "Enable samples which depend on Halcon" OFF)

set(SAMPLES
Camera/Basic/Capture
Camera/Basic/Capture2D
Camera/Basic/CaptureAssistant
Camera/Basic/CaptureFromFileCamera
Camera/Basic/CaptureWithSettingsFromYML
Camera/Basic/CaptureHDR
Camera/Basic/CaptureHDRCompleteSettings
Camera/Advanced/Capture2DAnd3D
Camera/Advanced/CaptureHDRLoop
Expand Down
14 changes: 11 additions & 3 deletions source/Camera/Basic/Capture/Capture.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Capture point clouds, with color, from the Zivid camera.
Capture colored point cloud, save 2D image, save 3D ZDF, and export PLY, using the Zivid camera.
*/

#include <Zivid/Zivid.h>
Expand All @@ -16,10 +16,18 @@ int main()
auto camera = zivid.connectCamera();

std::cout << "Creating default capture settings" << std::endl;
const auto settings = Zivid::Settings(Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} });
const auto settings = Zivid::Settings(
Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} },
Zivid::Settings::Color(
Zivid::Settings2D(Zivid::Settings2D::Acquisitions{ Zivid::Settings2D::Acquisition{} })));

std::cout << "Capturing frame" << std::endl;
const auto frame = camera.capture(settings);
const auto frame = camera.capture2D3D(settings);

const auto imageRGBA = frame.frame2D().value().imageRGBA();
const auto imageFile = "ImageRGB.png";
std::cout << "Saving 2D color image (linear RGB color space) to file: " << imageFile << std::endl;
imageRGBA.save(imageFile);

const auto dataFile = "Frame.zdf";
std::cout << "Saving frame to file: " << dataFile << std::endl;
Expand Down
85 changes: 0 additions & 85 deletions source/Camera/Basic/Capture2D/Capture2D.cpp

This file was deleted.

55 changes: 0 additions & 55 deletions source/Camera/Basic/CaptureAssistant/CaptureAssistant.cpp

This file was deleted.

25 changes: 15 additions & 10 deletions source/Camera/Basic/CaptureFromFileCamera/CaptureFromFileCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,28 @@ int main(int argc, char **argv)
Zivid::Application zivid;

const auto fileCamera =
userInput ? fileCameraPath : std::string(ZIVID_SAMPLE_DATA_DIR) + "/FileCameraZivid2M70.zfc";
userInput ? fileCameraPath : std::string(ZIVID_SAMPLE_DATA_DIR) + "/FileCameraZivid2PlusMR60.zfc";

std::cout << "Creating virtual camera using file: " << fileCamera << std::endl;
auto camera = zivid.createFileCamera(fileCamera);

std::cout << "Configuring settings" << std::endl;
const auto settings = Zivid::Settings{ Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} },
Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Enabled::yes,
Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Sigma{ 1.5 },
Zivid::Settings::Processing::Filters::Reflection::Removal::Enabled::yes,
Zivid::Settings::Processing::Filters::Reflection::Removal::Mode::global,
Zivid::Settings::Processing::Color::Balance::Red{ 1 },
Zivid::Settings::Processing::Color::Balance::Green{ 1 },
Zivid::Settings::Processing::Color::Balance::Blue{ 1 } };
Zivid::Settings settings{
Zivid::Settings::Acquisitions{ Zivid::Settings::Acquisition{} },
Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Enabled::yes,
Zivid::Settings::Processing::Filters::Smoothing::Gaussian::Sigma{ 1.5 },
Zivid::Settings::Processing::Filters::Reflection::Removal::Enabled::yes,
Zivid::Settings::Processing::Filters::Reflection::Removal::Mode::global,
};
Zivid::Settings2D settings2D{ Zivid::Settings2D::Acquisitions{ Zivid::Settings2D::Acquisition{} },
Zivid::Settings2D::Processing::Color::Balance::Red{ 1 },
Zivid::Settings2D::Processing::Color::Balance::Green{ 1 },
Zivid::Settings2D::Processing::Color::Balance::Blue{ 1 } };

settings.color() = Zivid::Settings::Color{ settings2D };

std::cout << "Capturing frame" << std::endl;
const auto frame = camera.capture(settings);
const auto frame = camera.capture2D3D(settings);

const auto dataFile = "Frame.zdf";
std::cout << "Saving frame to file: " << dataFile << std::endl;
Expand Down
47 changes: 0 additions & 47 deletions source/Camera/Basic/CaptureHDR/CaptureHDR.cpp

This file was deleted.

Loading
Loading