farm-ng-core
conv.h
Go to the documentation of this file.
1 // Copyright 2022, farm-ng inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "farm_ng/core/image.pb.h"
20 
21 namespace farm_ng {
22 
23 FARM_PROTO_CONV_TRAIT(sophus::ImageSize, core::proto::ImageSize);
24 FARM_PROTO_CONV_TRAIT(sophus::ImageLayout, core::proto::ImageLayout);
25 FARM_PROTO_CONV_TRAIT(sophus::PixelFormat, core::proto::PixelFormat);
26 FARM_PROTO_CONV_TRAIT(sophus::AnyImage<>, core::proto::DynImage);
27 
28 Expected<sophus::IntensityImage<>> intensityImageFromProto(
29  core::proto::DynImage const& proto);
30 
31 template <>
33  using ProtoType = core::proto::DynImage;
34 };
35 
36 template <>
37 auto toProt<sophus::IntensityImage<>>(sophus::IntensityImage<> const& cpp)
38  -> core::proto::DynImage;
39 
40 } // namespace farm_ng
sophus::IntensityImage
DynImage< IntensityImagePredicate, TAllocator > IntensityImage
Image to represent intensity image / texture as grayscale (=1 channel), RGB (=3 channel ) and RGBA (=...
Definition: dyn_image_types.h:68
farm_ng
Definition: backtrace.cpp:102
farm_ng::ToProtoTrait< sophus::IntensityImage<> >::ProtoType
core::proto::DynImage ProtoType
Definition: conv.h:33
farm_ng::FARM_PROTO_CONV_TRAIT
FARM_PROTO_CONV_TRAIT(Uri, core::proto::Uri)
dyn_image_types.h
sophus::ImageLayout
Layout of the image: width, height and pitch in bytes.
Definition: layout.h:23
sophus
Image MutImage, owning images types.
Definition: num_diff.h:20
farm_ng::intensityImageFromProto
Expected< sophus::IntensityImage<> > intensityImageFromProto(core::proto::DynImage const &proto)
Definition: conv.cpp:94
farm_ng::ToProtoTrait
Trait to associate one concrete Proto type with given C++ type TCpp.
Definition: proto_conv.h:25
sophus::DynImage
Type-erased image with shared ownership, and read-only access to pixels. Type is nullable.
Definition: dyn_image.h:24
proto_conv.h
sophus::ImageSize
Image size, hence its width and height.
Definition: image_size.h:21
sophus::PixelFormat
Definition: pixel_format.h:15