A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

Image
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...

Sample Codes: rotate & scale an image with OpenCV on Ubuntu 16.04

First of all, please configure opencv on your linux system.


simple build from source code:
git clone https://github.com/lengerrong/opencv.git
cd opencv/
mkdir build
cd build/
cmake ..
make -j128
sudo make install
sudo ldconfig


Sample codes:
#include <opencv2/opencv.hpp>

#include <errno.h>
#include <iostream>
#include <limits.h>
#include <stdlib.h>

using namespace std;
using namespace cv;

void rotateimage(const Mat& image, Mat& out)
{
    // rotation angle in degrees. Positive values mean counter-clockwise rotation
    cout << "please enter rotate degree:" << endl;   
    double angle;
    cin >> angle;
    // isotropic scale factor.
    cout << "please enter scale factor:" << endl;
    double scale;   
    cin >> scale;
    //rotate centre
    Point2f center = Point2f(image.cols / 2, image.rows / 2);
    // calculates an affine matrix of 2D rotation
    Mat rotateMat = getRotationMatrix2D(center, angle, scale);
    // applies an affine transformation to an image
    warpAffine(image, out, rotateMat, image.size());
}

int main(int argc, char **argv)
{
    if (argc < 2) {
        cout << "no input image" << endl;
        return -1;
    }
    // resolve image path
    char resolvepath[PATH_MAX];
    if (!realpath(argv[1], resolvepath)) {
        cout << strerror(errno) << endl;
        return -2;
    }
    cout << "rotate image :" << resolvepath << endl;
    Mat image = imread(resolvepath);
    if (image.empty()) {
        cout << "read image failed";
        return -3;
    }
    Mat out;
    rotateimage(image, out);
    imwrite("rotate.png", out);
    return 0;
}


Compile command:
g++ -o rotateimage rotateimage.cpp  `pkg-config --cflags --libs opencv`

Run rotateimage:
./rotateimage  origin.png
rotate image :/home/lenger/origin.png

please enter rotate degree:
-17.8
please enter scale factor:
0.5


Sample Result:
origin.png














rotate.png






❤️ Support This Blog


If this post helped you, you can support my writing with a small donation. Thank you for reading.


Comments

Popular Posts

Fix “A problem occurred starting process 'command node'” in Android Studio for React Native

Fix up watchman issue with Ghost

Using Mutual TLS (mTLS) in Next.js (Server-Side Only)