Giter Club home page Giter Club logo

smallcv's Introduction

SmallCV

unittest Windows Ubuntu macOS

Small Computer Vision Library.

Features

  • Lightweight
    • C++11 based
    • Not including optimization
  • Conformance
    • API like OpenCV
    • Same result on PC and Android

APIs

Supported:

  • Mat
  • imread()/imwrite()/imshow()/waitKey()
  • cvtColor()/resize()
  • putText()/rectangle()/circle()/line()

Not supported:

  • Mat::clone()
  • saturate_cast
  • parallel_for_
  • operator Point_<Tp2>

Getting Started

To build this project, you are assumed:

  • Familiar with CMake based C/C++ building
  • Install glfw for imshow(). See deps/glfw_build for build hints.
  • Modify cmake/deps.cmake to specify dependencies paths.
cd build
./linux-x64.sh   # Linux build
./Xcode.sh       # macOSX build
.\vs2019-x64.cmd # Windows build

Example Usage

#include <string>
#include "smallcv.hpp"

int main() {
    std::string image_path = "mingren.jpg";
    cv::Mat image = cv::imread(image_path);
    cv::Rect rect(100, 100, 233, 233);
    cv::rectangle(image, rect, cv::Scalar(0,0,255), 2);
    cv::imshow("mingren", image);
    cv::waitKey(0);
    cv::imwrite("mingren_swap.bmp", image);

    return 0;
}

#include <string>
#include "smallcv.hpp"

int main()
{
    std::string image_path = "mingren.jpg";
    //std::string image_path = "E:/projects/arccv/smallcv/build/vs2019-x64/mingren.jpg";
    cv::Mat image = cv::imread(image_path);
    cv::Rect rect(100, 100, 233, 233);
    cv::rectangle(image, rect, cv::Scalar(0,0,255), 2);
    
    cv::Mat bigger_image;
    cv::Size ssize = image.size();
    cv::Size dsize = ssize * 2;
    cv::resize(image, bigger_image, dsize);

    cv::Mat gray;
    cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY);
    

    cv::putText(image, "image", cv::Point(60, 60), 10, 1, cv::Scalar(255, 0, 0), 2);
    cv::putText(bigger_image, "bigger image", cv::Point(60, 60), 10, 1, cv::Scalar(255, 0, 0), 2);
    cv::putText(gray, "gray", cv::Point(60, 60), 10, 1, cv::Scalar(255, 0, 0), 2);

    cv::imshow("mingren", image);
    cv::imshow("bigger image", bigger_image);
    cv::imshow("gray", gray);

    cv::waitKey(0);

    cv::imwrite("image.png", image);
    cv::imwrite("bigger_image.png", bigger_image);
    cv::imwrite("gray.png", gray);
}

Acknowledgement

SmallCV referenced the following projects:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.