Skip to content

Contribution

George Profenza edited this page Oct 5, 2020 · 3 revisions

Current development state

The following ofxCv functionality is not ported yet. If you're planning on porting ofxCv examples or contributed here is an overview of what's missing in p5.cv:

ofxCv filename ofxCv function ofxCv custom classes/functions is it used by ofxCv examples ? OpenFrameworks class OpenCV c++ classes / functions is it in OpenCV.js already ?
Wrappers.h loadMat(cv::Mat& mat, std::string filename) yes N/A
void saveMat(cv::Mat mat, std::string filename) N/A
void saveImage(cv::Mat& mat, std::string filename, ofImageQualityType qualityLevel = OF_IMAGE_QUALITY_BEST) N/A
wrapThree(max) N/A
wrapThree(min) N/A
wrapThree(multiply) N/A
wrapThree(divide) N/A
wrapThree(add) N/A
wrapThree(subtract) N/A
wrapThree(absdiff) N/A
wrapThree(bitwise_and) N/A
wrapThree(bitwise_or) N/A
wrapThree(bitwise_xor) N/A
ofMatrix4x4 estimateAffine3D(std::vector& from, std::vector& to, float accuracy = .99) ofMatrix4x4 estimateAffine3D N/A
ofMatrix4x4 estimateAffine3D(std::vector& from, std::vector& to, std::vector& outliers, float accuracy = .99)
Helpers.h yes ofMatrix4x4
template cv::Point3_ intersectLineLine(cv::Point3_ lineStart1, cv::Point3_ lineEnd1, cv::Point3_ lineStart2, cv::Point3_ lineEnd2)
template cv::Point3_ intersectPointLine(cv::Point3_ point, cv::Point3_ lineStart, cv::Point3_ lineEnd)
template cv::Point3_ intersectPointRay(cv::Point3_ point, cv::Point3_ ray)
template void thin(T& img)
template <class S, class T, class D>float autorotate(S& src, D& dst, float threshold1 = 50, float threshold2 = 200) autorotate Canny cv.Canny
template <class S, class T, class D>float autorotate(S& src, T& thresh, D& dst) HoughLinesP cv.HoughLinesP
std::vectorcv::Point2f getConvexPolygon(const std::vectorcv::Point2f& convexHull, int targetPoints) approxPolyDP cv.approxPolyDP
Kalman.h template class KalmanPosition_ private cv::KalmanFilter KF no KalmanFilter N/A
template class KalmanPosition_ private cv::Mat_ measurement, prediction, estimated
template class KalmanPosition_ public void init(T smoothness = 0.1, T rapidness = 0.1, bool bUseAccel = false)
template class KalmanPosition_ public void update(const ofVec3f&)
template class KalmanPosition_ public ofVec3f getPrediction()
template class KalmanPosition_ public ofVec3f getEstimation()
template class KalmanPosition_ public ofVec3f getVelocity()
template class KalmanEuler_ : public KalmanPosition_ private ofVec3f eulerPrev
template class KalmanEuler_ : public KalmanPosition_ public void init(T smoothness = 0.1, T rapidness = 0.1, bool bUseAccel = false)
template class KalmanEuler_ : public KalmanPosition_ public void update(const ofQuaternion&) ofQuaternion
template class KalmanEuler_ : public KalmanPosition_ public ofQuaternion getPrediction() ofQuaternion
template class KalmanEuler_ : public KalmanPosition_ public ofQuaternion getEstimation() ofQuaternion
typedef KalmanEuler_ KalmanEuler;
Distance.h int editDistance(const std::string& a, const std::string& b) no
const std::string& mostRepresentative(const std::vectorstd::string& strs)
Calibration.h enum CalibrationPattern {CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID} yes
class Intrinsics public void setup(float focalLengthMm, cv::Size imageSizePx, cv::Size2f sensorSizeMm, cv::Point2d principalPointPct = cv::Point2d(.5,.5))
class Intrinsics public void setup(cv::Mat cameraMatrix, cv::Size imageSizePx, cv::Size2f sensorSizeMm = cv::Size2f(0, 0))
class Intrinsics public void setImageSize(cv::Size imgSize)
class Intrinsics public cv::Mat getCameraMatrix() const
class Intrinsics public cv::Size getImageSize() const
class Intrinsics public cv::Size2f getSensorSize() const
class Intrinsics public cv::Point2d getFov() const
class Intrinsics public double getFocalLength() const
class Intrinsics public double getAspectRatio() const
class Intrinsics public cv::Point2d getPrincipalPoint() const
class Intrinsics public void loadProjectionMatrix(float nearDist = 10., float farDist = 10000., cv::Point2d viewportOffset = cv::Point2d(0, 0)) const ofViewport, ofSetMatrixMode, ofLoadIdentityMatrixofMatrix4x4, ofMultMatrix, ofSetMatrixMode,
class Intrinsics protected void updateValues() void calibrationMatrixValues( InputArray cameraMatrix, Size imageSize, double apertureWidth, double apertureHeight, CV_OUT double& fovx, CV_OUT double& fovy, CV_OUT double& focalLength, CV_OUT Point2d& principalPoint, CV_OUT double& aspectRatio ) N/A
class Intrinsics protected cv::Mat cameraMatrix
class Intrinsics protected cv::Size imageSize
class Intrinsics protected cv::Size2f sensorSize
class Intrinsics protected cv::Point2d fov
class Intrinsics protected double focalLength, aspectRatio
class Intrinsics protected cv::Point2d principalPoint
class Calibration : public ofNode public Calibration() ofNode
class Calibration public void save(std::string filename, bool absolute = false) const FileStorage YAML N/A
class Calibration public void load(std::string filename, bool absolute = false) FileStorage YAML N/A
class Calibration public void loadLcp(string filename, float focalLength, bool absolutePath = false) ofXml
class Calibration public void reset()
class Calibration public void setPatternType(CalibrationPattern patternType)
class Calibration public void setPatternSize(int xCount, int yCount)
class Calibration public void setSquareSize(float squareSize)
class Calibration public void setSubpixelSize(int subpixelSize)
class Calibration public bool add(cv::Mat img)
class Calibration public bool clean(float minReprojectionError = 2.f)
class Calibration public bool calibrate() calibrateCamera, checkRange N/A
class Calibration public bool calibrateFromDirectory(std::string directory)
class Calibration public bool findBoard(cv::Mat img, std::vectorcv::Point2f &pointBuf, bool refine = true) copyGray findChessboardCorners, cornerSubPix, findCirclesGridTermCriteria N/Acv.TermCriteria
class Calibration public void setIntrinsics(Intrinsics& distortedIntrinsics)
class Calibration public void setDistortionCoefficients(float k1, float k2, float p1, float p2, float k3=0, float k4=0, float k5=0, float k6=0)
class Calibration public void undistort(cv::Mat img, int interpolationMode = cv::INTER_LINEAR)
class Calibration public void undistort(cv::Mat src, cv::Mat dst, int interpolationMode = cv::INTER_LINEAR)
class Calibration public ofVec2f undistort(ofVec2f& src) const
class Calibration public void undistort(std::vector& src, std::vector& dst) const
class Calibration public bool getTransformation(Calibration& dst, cv::Mat& rotation, cv::Mat& translation)
class Calibration public float getReprojectionError() const
class Calibration public float getReprojectionError(int i) const
class Calibration public const Intrinsics& getDistortedIntrinsics() const
class Calibration public const Intrinsics& getUndistortedIntrinsics() const
class Calibration public cv::Mat getDistCoeffs() const
class Calibration public void setFillFrame(bool fillFrame)
class Calibration public int size() const
class Calibration public cv::Size getPatternSize() const
class Calibration public float getSquareSize() const
class Calibration public static std::vectorcv::Point3f createObjectPoints(cv::Size patternSize, float squareSize, CalibrationPattern patternType)
class Calibration public void customDraw()
class Calibration public void draw(int i) const
class Calibration public void draw3d() const
class Calibration public void draw3d(int i) const
class Calibration public bool isReady()
class Calibration public std::vector<std::vectorcv::Point2f > imagePoints
class Calibration protected CalibrationPattern patternType
class Calibration protected cv::Size patternSize, addedImageSize, subpixelSize
class Calibration protected float squareSize
class Calibration protected cv::Mat grayMat
class Calibration protected cv::Mat distCoeffs
class Calibration protected std::vectorcv::Mat boardRotations, boardTranslations
class Calibration protected std::vector<std::vectorcv::Point3f > objectPoints
class Calibration protected float reprojectionError
class Calibration protected std::vector perViewErrors
class Calibration protected bool fillFrame
class Calibration protected cv::Mat undistortBuffer
class Calibration protected cv::Mat undistortMapX, undistortMapY
class Calibration protected void updateObjectPoints()
class Calibration protected void updateReprojectionError() projectPoints, norm N/A, cv.norm
class Calibration protected void updateUndistortion() getOptimalNewCameraMatrix() N/A
class Calibration protected Intrinsics distortedIntrinsics
class Calibration protected Intrinsics undistortedIntrinsics
class Calibration protected bool ready
CLD * example-coherent-lines

Regarding the thin method for skeletonization I recommend checking out LingDong's skeletonization-js project. It is awesome !

As for the ofxCv examples:

Kyle McDonalds ofxCv examples status
example-ar not ported: OpenCV.js is currently missing calibration, p5.js doesn't have a p5.Matrix class (needs lib)
example-background ported
example-bayer ported
example-blur ported
example-calibration-lcp not ported: OpenCV.js is currently missing, p5.js doesn't have a p5.Matrix class (needs lib)
example-calibration not ported: OpenCV.js is currently missing, p5.js doesn't have a p5.Matrix class (needs lib)
example-coherent-lines not ported: required porting the Coherent Line Drawing (CLD) lib
example-contours-advanced in progress
example-contours-basic ported
example-contours-color ported
example-contours-following in progress
example-contours-quad ported
example-contours-tracking in progress
example-difference-columns in progress
example-difference in progress
example-edge in progress
example-empty to be ported
example-estimate-affine not ported: OpenCV.js may need a few functions, p5.js doesn't have matrix / quaternion support (needs lib)
example-face-follow in progress
example-face-zoom in progress
example-face in progress
example-flow-distort to be ported
example-flow-distort-shader to be ported
example-flow-keypoints in progress
example-flow mostly ported (Farneback OpticalFlow is ported, but slow)
example-gamma to be ported
example-gesture to be ported
example-highpass in progress
example-homography not ported
example-kalman-euler not ported: OpenCV.js is currently missing KalmanFilter, p5.js doesn't have quaternion support (needs lib)
example-kalman not ported: OpenCV.js is currently missing KalmanFilter
example-smile in progress
example-threshold ported
example-undistortion not ported: OpenCV.js is currently missing calibration

The github repo is blatantly lifted from p5.js-sound.

The p5.js-sound Contribute wiki in terms of setup applies here.

It's still early days for the library so please be patient and expect many changes (potentially even to method signatures here and there).

Clone this wiki locally