Skip to content

Commit

Permalink
Merge pull request #1212 from luxonis/imagemanipv2_bugfixes
Browse files Browse the repository at this point in the history
ImageManipV2 bugfixes
  • Loading branch information
asahtik authored Jan 23, 2025
2 parents d8e4a5c + 00de06b commit 50a8f57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceRVC4Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(DEPTHAI_DEVICE_RVC4_MATURITY "snapshot")

# "version if applicable"
# set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+93f7b75a885aa32f44c5e9f53b74470c49d2b1af")
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+a0274cd7dafa3622160fe0c7d1fccfc1937ec268")
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+09829e4939aeb5118b7d77fb6733ae614a5c485a")
14 changes: 9 additions & 5 deletions include/depthai/utility/ImageManipV2Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2351,23 +2351,27 @@ template <template <typename T> typename ImageManipBuffer, typename ImageManipDa
ImageManipOperations<ImageManipBuffer, ImageManipData>& ImageManipOperations<ImageManipBuffer, ImageManipData>::build(
const ImageManipOpsBase<Container>& newBase, ImgFrame::Type outType, FrameSpecs srcFrameSpecs, ImgFrame::Type inFrameType) {
const auto newCfgStr = getConfigString(newBase);
if(outType == ImgFrame::Type::NONE) {
if(base.colormap != Colormap::NONE) outType = VALID_TYPE_COLOR;
else outType = inFrameType;
}
if(newCfgStr == prevConfig && outType == outputFrameType && srcFrameSpecs.width == srcSpecs.width && srcFrameSpecs.height == srcSpecs.height
&& inFrameType == inType)
return *this;
prevConfig = newCfgStr;
outputOps.clear();

if(srcFrameSpecs.width <= 1 || srcFrameSpecs.height <= 1) {
throw std::runtime_error("Input image is one dimensional");
}

if(newBase.hasWarp(srcFrameSpecs.width, srcFrameSpecs.height)) mode = mode | MODE_WARP;
if(newBase.colormap != Colormap::NONE && isSingleChannelu8(inFrameType)) mode = mode | MODE_COLORMAP;
if(outType != ImgFrame::Type::NONE && outType != inFrameType) mode = mode | MODE_CONVERT;
if(outType != inFrameType) mode = mode | MODE_CONVERT;

assert(inFrameType != ImgFrame::Type::NONE);
base = newBase;
outputFrameType = outType;
if(outType == ImgFrame::Type::NONE) {
if(base.colormap != Colormap::NONE) outputFrameType = VALID_TYPE_COLOR;
else outputFrameType = inFrameType;
}
inType = inFrameType;
type = inType;
srcSpecs = srcFrameSpecs;
Expand Down
1 change: 1 addition & 0 deletions src/utility/ImageManipV2Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ size_t dai::impl::getAlignedOutputFrameSize(ImgFrame::Type type, size_t width, s
return ALIGN_UP(ALIGN_UP(width, 8) * height, PLANE_ALIGNMENT) + ALIGN_UP(width, 8) * (height / 2);
case ImgFrame::Type::RAW8:
case ImgFrame::Type::GRAY8:
return ALIGN_UP(width, 8) * height;
case ImgFrame::Type::YUV422i:
case ImgFrame::Type::YUV444p:
case ImgFrame::Type::YUV422p:
Expand Down

0 comments on commit 50a8f57

Please sign in to comment.