Java Code Examples for org.bytedeco.javacpp.indexer.UByteIndexer#put()

The following examples show how to use org.bytedeco.javacpp.indexer.UByteIndexer#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestImageTransform.java    From DataVec with Apache License 2.0 6 votes vote down vote up
public static ImageWritable makeRandomImage(int height, int width, int channels) {
    if (height <= 0) {
        height = rng.nextInt() % 100 + 200;
    }
    if (width <= 0) {
        width = rng.nextInt() % 100 + 200;
    }
    Mat img = new Mat(height, width, CV_8UC(channels));
    UByteIndexer idx = img.createIndexer();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            for (int k = 0; k < channels; k++) {
                idx.put(i, j, k, rng.nextInt());
            }
        }
    }
    Frame frame = converter.convert(img);
    return new ImageWritable(frame);
}
 
Example 2
Source File: TestNativeImageLoader.java    From DataVec with Apache License 2.0 6 votes vote down vote up
Mat makeRandomImage(int height, int width, int channels) {
    if (height <= 0) {
        height = rng.nextInt() % 100 + 100;
    }
    if (width <= 0) {
        width = rng.nextInt() % 100 + 100;
    }

    Mat img = new Mat(height, width, CV_8UC(channels));
    UByteIndexer idx = img.createIndexer();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            for (int k = 0; k < channels; k++) {
                idx.put(i, j, k, rng.nextInt());
            }
        }
    }
    return img;
}
 
Example 3
Source File: TestImageTransform.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
public static ImageWritable makeRandomImage(int height, int width, int channels) {
    if (height <= 0) {
        height = rng.nextInt() % 100 + 200;
    }
    if (width <= 0) {
        width = rng.nextInt() % 100 + 200;
    }
    Mat img = new Mat(height, width, CV_8UC(channels));
    UByteIndexer idx = img.createIndexer();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            for (int k = 0; k < channels; k++) {
                idx.put(i, j, k, rng.nextInt());
            }
        }
    }
    Frame frame = converter.convert(img);
    return new ImageWritable(frame);
}
 
Example 4
Source File: TestNativeImageLoader.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
Mat makeRandomImage(int height, int width, int channels) {
    if (height <= 0) {
        height = rng.nextInt() % 100 + 100;
    }
    if (width <= 0) {
        width = rng.nextInt() % 100 + 100;
    }

    Mat img = new Mat(height, width, CV_8UC(channels));
    UByteIndexer idx = img.createIndexer();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            for (int k = 0; k < channels; k++) {
                idx.put(i, j, k, rng.nextInt());
            }
        }
    }
    return img;
}
 
Example 5
Source File: ImageConversionUtils.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
public static Mat makeRandomImage(int height, int width, int channels) {
    if (height <= 0) {

        height = new Random().nextInt() % 100 + 100;
    }
    if (width <= 0) {
        width = new Random().nextInt() % 100 + 100;
    }

    Mat img = new Mat(height, width, CV_8UC(channels));
    UByteIndexer idx = img.createIndexer();
    for (int i = 0; i < height; i++) {
        for (int j = 0; j < width; j++) {
            for (int k = 0; k < channels; k++) {
                idx.put(i, j, k, new Random().nextInt());
            }
        }
    }
    return img;
}