boofcv.abst.disparity.WrapDisparitySgm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boofcv-ip-multiview Show documentation
Show all versions of boofcv-ip-multiview Show documentation
BoofCV is an open source Java library for real-time computer vision and robotics applications.
/*
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package boofcv.abst.disparity;
import boofcv.alg.disparity.sgm.SgmStereoDisparity;
import boofcv.struct.image.GrayF32;
import boofcv.struct.image.GrayU8;
import boofcv.struct.image.ImageGray;
import boofcv.struct.image.ImageType;
import org.jetbrains.annotations.Nullable;
public class WrapDisparitySgm> implements StereoDisparity {
SgmStereoDisparity sgm;
@Nullable GrayF32 subpixel;
public WrapDisparitySgm( SgmStereoDisparity sgm, boolean subPixel ) {
this.sgm = sgm;
this.subpixel = subPixel ? new GrayF32(1, 1) : null;
}
@Override
public void process( GrayU8 imageLeft, GrayU8 imageRight ) {
sgm.process(imageLeft, imageRight);
sgm.saveScore();
if (subpixel != null) {
sgm.subpixel(sgm.getDisparity(), subpixel);
}
}
@Override
public DI getDisparity() {
if (subpixel != null) {
return (DI)subpixel;
} else {
return (DI)sgm.getDisparity();
}
}
@Override public @Nullable GrayF32 getDisparityScore() {
return sgm.getScore();
}
@Override
public int getDisparityMin() {
return sgm.getDisparityMin();
}
@Override
public int getDisparityRange() {
return sgm.getDisparityRange();
}
@Override
public int getInvalidValue() {
return sgm.getInvalidDisparity();
}
@Override
public int getBorderX() {
return 0;
}
@Override
public int getBorderY() {
return 0;
}
@Override
public ImageType getInputType() {
return ImageType.SB_U8;
}
@Override
public Class getDisparityType() {
return (Class)(subpixel == null ? GrayF32.class : GrayU8.class);
}
public SgmStereoDisparity getAlgorithm() {
return sgm;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy