Giter Club home page Giter Club logo

catalano-framework's Introduction

Catalano Framework

The Catalano Framework is a framework for scientific computing for Java and Android. The project started as an initial port of the many features of the AForge.NET and Accord.NET frameworks for .NET, but is steadily growing with more advanced features which are now being shared between those projects.

The project is organized under the same architecture found in the afore mentioned frameworks. Experienced users who would wish to leverage their expertise on Accord and AForge to work on Android can rely on the same namespaces for:

  • Fuzzy
  • Graph
  • IO
    • Arff
    • CSV
    • Generic data parser
  • Image Processing
    • Coutour
    • Corner
    • Filters
    • Texture
    • Shapes
  • Machine Learning
    • Classification
    • Clustering
    • Exploration
    • Feature Selection
    • Regression
  • Math
    • Decompositions
    • Dissimilarities
    • Distances
    • Functions
    • Geometry
    • Transforms
    • Wavelets
  • Neural Networks
  • Signal
  • Statistics
    • Analysis
    • Distributions
    • Kernels
    • Regression
  • Video
  • Vision

Version

1.6

License

LGPL

The framework is released under the LGPL, which means it can be used even inside commercial applications.

catalano-framework's People

Contributors

arantius avatar diegocatalano avatar gluttonylord avatar oxydron avatar rmtheis avatar yuripourre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

catalano-framework's Issues

Getting Null pointer Exception on image's getGray while calculating difference between two images

Hi,

I am newbie to image processing and i am using this framework for first time.

I am getting null pointer exception when your code try to access gray of the image
Exception in thread "main" java.lang.NullPointerException at Catalano.Imaging.FastBitmap.getGray(FastBitmap.java:942) at Catalano.Imaging.Tools.ObjectiveFidelity.getMSE(ObjectiveFidelity.java:122) at qualityanalysis.QualityAnalysis.calculate(QualityAnalysis.java:44) at qualityanalysis.QualityAnalysis.main(QualityAnalysis.java:105)

I am using simple code mentioned here in the answer.

gwo

hello where is the main of gwo file?

DrawLine inverts X and Y coordinates

  • Catalano Framework: 1.4
  • Android 4.4.4

Hello Diego,
if i run this sample code:

FastGraphics graph = new FastGraphics(image);
graph.setColor(180, 255, 50);
graph.DrawLine(new IntPoint(10, 10), new IntPoint(10, 110));
_imgView.setImageBitmap(image.toBitmap());

I expect a vertical line to be drawn but an horizontal one is drawn instead (is IntPoint(x, y) right?)

I have another issue, maybe related to the above mentioned (major issues in the pixel coordinate management?), if I call the DrawCircle this way:

_graph.DrawCircle(new IntPoint(269, 15), 5)

I got this exception:
java.lang.ArrayIndexOutOfBoundsException: length=76800; index=87695
at Catalano.Imaging.FastBitmap.setRGB(FastBitmap.java:438)
at Catalano.Imaging.FastGraphics.DrawCircle(FastGraphics.java:97)
at Catalano.Imaging.FastGraphics.DrawCircle(FastGraphics.java:81)

The frame size is 320 x 240 (width x height) so, theoretically I should be able to draw a 5 pixels radius circle at 269,15 (x,y).

Anyway, thank you for this great framework.
Claudio

OutOfMemory Issue

Hi @DiegoCatalano,

       While i captured image using android Indent and after converting to mutable bitmap image with **_Bitmap.Config.ARGB_8888_** and passing to Fastbitmap  the following error arises,

E/AndroidRuntime: FATAL EXCEPTION: main
Process: catalano.imaging, PID: 3401
java.lang.OutOfMemoryError: Failed to allocate a 31961100 byte allocation with 12540956 free bytes and 11MB until OOM
at catalano.imaging.FastBitmap.refresh(FastBitmap.java:179)
at catalano.imaging.FastBitmap.(FastBitmap.java:82)

Please any one give solution to solve this,

Thanking You !!

Blend Filter issue

I was reading the filters and I found something odd. Every part of the Blend filter fastBitmap is updated but in line 357 overlay is updated, is it a typo?

Blend.java#L357

Hidden Markov Models

Dear Catalano,

It seems this is the only way to reach you. I found HMM models on Accord net framework very useful. Do you have any plans to port HMM classifier to Java and Android? If you, when do you expect to finish?

Android: Concurrent HSLFilter bug?!

Hey,

i tried using the concurrent HSLFilter in an Android application. It didn't work at all, so i tried debugging the app:
hslfilter

Previously the Share-Object is created like this here:
t[i] = new Thread(new Run(new Share(fastBitmap, startX, startX + part)));

Since the Share object is initialized without the endWidth parameter, it is 0, which will cause the algorithm to never execute the inner for-loop.

Hope this can be fixed in the next release.

Hu Moment . Can i have a sample codes ?

Anyone can give me some sample programs or codes that can get the hu moment of images using this library .I really need your help. I will appreciate your help. Thanks in advance! this is sample images that used in my project

data0043

IllegalStateException

HI Diego,

I use your nice Framework, but now as I switch to android I get a exception during fastBitmap.toBitmap().
Exception is:
java.lang.IllegalStateException: Can't call setPixels() on a recycled bitmap
07-01 09:42:18.942 12791 13040 E AndroidRuntime: at android.graphics.Bitmap.checkRecycled(Bitmap.java:243)
07-01 09:42:18.942 12791 13040 E AndroidRuntime: at android.graphics.Bitmap.setPixels(Bitmap.java:1250)
07-01 09:42:18.942 12791 13040 E AndroidRuntime: at Catalano.Imaging.FastBitmap.toBitmap(FastBitmap.java:854)

Can you help me? Maybe it´s a problem because i recycle the Bitmap to fast?

Example of active contour / snake algorithm

I am looking for a active contour algorithm to find object contours in images.
Can you tell me how to use you snake implementation?
Do you have an snipet as an example?

Thanks

fft process returns blank image

hi, Catalano, fft process returns blank (full wihite) image. where i m doing wrong? i attached code and input, output images.

FastBitmap fb = new FastBitmap(imagePath);

Grayscale grayscale = new Grayscale();
grayscale.applyInPlace(fb);
fb.saveAsJPG(path + "grayscale_" + FilenameUtils.getBaseName(imagePath) + ".jpg");

FourierTransform ft = new FourierTransform(fb);
ft.Forward();
fb = ft.toFastBitmap();
fb.saveAsJPG(path + "fft_" + FilenameUtils.getBaseName(imagePath) + ".jpg");

FrequencyFilter ff = new FrequencyFilter(0, 60);
ff.ApplyInPlace(ft);
fb = ft.toFastBitmap();
fb.saveAsJPG(path + "freq_" + FilenameUtils.getBaseName(imagePath) + ".jpg");

slippies
grayscale_slippies
fft_slippies
freq_slippies

BlobDetection.ProcessImage confusing width/height iterator

Hello,

Does the BlobDetection create blobs having their x and y coordinates rotated? Is this a feature or a bug?

From the BlobDetection codes, it seems, strangely enough, that x is used iterate height and y is used to iterate width when the blobs are created. What is the reason for this?

Good work on the framework :)

OutOfMemory exception.

Is there a way to avoid OutOfMemory exception when editing images with high resolution?

How to import this framework?

I have created a package and placed the files in it, Android Studio complains that it cannot resolve symbol Catalano, even though autocomplete suggest it just fine. A maven or jar to import would be much appreciated to avoid this hassle with AS importing.

Red eye removal

Are there any plans for an red eye removal algorithm?
I cannot find any good solution for this in java.

Understanding HistogramOfOrientedGradients.java

Typically, a feature descriptor (HOG descriptor) converts an image of size width x height x 3 (channels ) to a feature vector / array of length n.
The ProcessImage method in the file HistogramOfOrientedGradients.java has desription "Process image looking for corners" and returns "list of found corners (X-Y coordinates)".
Can You explain what is doing this class and how to interpret the return values?
Thank You.

ImageStatistics - Exception handling

Hello,

The ImageStatistics class seems to throw&print exception stack traces unnecessarily (in several locations). They are all printed on System.out.
Example:
try {
throw new Exception("Histogram red null");
} catch (Exception e) {
e.printStackTrace();
}

You could try adding logging (JDK/log4j/...) instead?

Br,
Saku

For Jar Request

Hi DiegoCatalano,

                 I am now trying to use your updated Catalano-Framework for android image processing, I am getting issues of some missing sub files. Can you provide Jar Files or Gradle for Core,Fuzzy,Math and other libraries. 

Can you show the screenshots of the filters?

Hi Catalano,you have a lot of filters available in your library that i am really confused which one to use,can you put up images of every filter taking a single photo and applying every one on that so that everyone can easily get to know what each filter does to my photo.It would be a great help.
And please add the vignette effect if possible.
Thanks

Couldn't correct orientation: java.lang.IllegalStateException error when trying to do UnSharpMasking

I am processing an Image to make it Tesseract-OCR friendly using Catalano framework. Thresholding is working fine but when I try to UnsharpMasking or resizing I get an error Couldn't correct orientation: java.lang.IllegalStateException: Can't call setPixels() on a recycled bitmap even though I have set BitmapFactory options inmutable to true & minsdk=11.

Code snippet:
FastBitmap fb = new FastBitmap(bitmap);
Grayscale grayScale = new Grayscale();
grayScale.applyInPlace(fb);

        switch (thresholdFilterName) {
        case "Threshold":  Threshold t = new Threshold(100);
        t.applyInPlace(fb);
        break;

        case "BradleyLocalThreshold":  BradleyLocalThreshold blt = new BradleyLocalThreshold();
        blt.applyInPlace(fb);
        break;

        case "SauvolaThreshold":  SauvolaThreshold st =new SauvolaThreshold();
        st.applyInPlace(fb);
        break;

        case "NiblackThreshold":  NiblackThreshold nt =new NiblackThreshold();
        nt.applyInPlace(fb);
        break;

        case "WolfJoulionThreshold": WolfJoulionThreshold wjt =new WolfJoulionThreshold();
        wjt.applyInPlace(fb);
        break;

        default: WolfJoulionThreshold wjtD =new WolfJoulionThreshold();
        wjtD.applyInPlace(fb);
        break;

        }


        UnsharpMasking um= new UnsharpMasking();
        um.applyInPlace(fb);
    // exception is thrown here.

Another thing is that BradleyLocalThreshold gives best result in lighting conditions where there is shadow on image but the accuracy of OCR engine is poor with it, where as accuracy with HysteresisThreshold is quiet high but it doesn't work well in lighting conditions. Is there any way we have best of both algorithms.

Instagram like Filters

Hi, I really like your work on image processing.
It would be great if you can add the filters same to those in Instagram (Amaro,Lomo-fi,etc)
It would be a great help.
thanks

Sample programs or codes for image processing.

Anyone can give me some sample programs or codes that can get the pixels of an image. Total pixels, pixels per fold, how to fold an image, cut the image excess space of the image. I really need your help. I will appreciate your help. Thanks in advance!

Green screen algorithm

Hi,

do you plan to integrate a green screen (color key) masking algorithm?
Or do you have any advice for me ho i can achieve something like this?

Thanks
Sebastian

Index out of bound exception while using Opening filter

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 44000
 at Catalano.Imaging.FastBitmap.setGray(FastBitmap.java:813)
 at Catalano.Imaging.Filters.Erosion.applyInPlace(Erosion.java:94)
 at Catalano.Imaging.Filters.Opening.ApplyInPlace(Opening.java:80)
 at Catalano.Imaging.Filters.Opening.applyInPlace(Opening.java:63)
...

Filters applied before:

  • Grayscale
    • Grayscale.Algorithm.Lightness
  • Crop
    • x = 50
    • y = 0
    • width = 440
    • height = 100
  • Threshold
    • value = 30
    • invert = true

We wanted to apply an Opening filter with radius = 5.

It works fine with the jars from codeproject but neither with the source from their nor with the source from github.

How can I increase the DPI of an image?

Hi Folks,
This is one of the most useful image processing libraries for Android. And what for bytes (lean and mean). Presently I need to increase the dpi(resolution) of an image. Should I use ResizeBicubic?

Threshold not working when inverted

I found a bug in the threshold class, when it is not inverted a value greather or equals than the specified is white, but when it is inverted a value less than the specified is black, painting in both cases the same images. Just need to change the condicional from less than to greather or equals to.

Greetings

Optimizing convolution

Hello,

I've been running few algrothms against my material (>50MB images). Do you have in your roadmap a slot to optimize the Convolution process to use direct pixel byte/int arrays (produced by FastBitMap.getGrayData() and FastBitMap.getRGBData()) instead of using copy.getGray/Red/Green/Blue methods?

This might speed up things (blurs, edgedetectors) considerably.

BR,
Saku

Zernike Moment: How to computer Zernike Moment

Hi there,
I want to compute Zernike Moment. Have referred to your code for computing Zernike moments, however what input shall be given to the ZernikeMoments() function is unclear to me.

viz.
/**
* Compute the set of Zernike's moments up to the specified order.
* Also compute the width, height, and centroid of the shape.
* @param order Order.
* @param x X axis coordinates.
* @param y Y axis coordinates.
* @param npoints Indicates the total number of points in the digitized shape.
* @return Zernike`s moments.
*/
public static ComplexNumber[] ZernikeMoments(int order, double[] x, double[] y, int npoints){
}

What are the X axis coordinates and Y axis coordinates?
From what I understand, if it's a coordinate, it should be simple value double x, double y, and not any array.
Also for computing moment of image, function should take input as a image as maybe BufferedImage or 2D image array[][].

Sorry for being so naive. I am image processing newbie, and weak in math.

Thank you.

Homomorphic Filtering

Hi, I am trying to implement the Homomorphic filter to some images, but it doesn't seem to work correctly for some reason. Is there any sample code for this?

Also I am not aware about the min,max range of frequencies that are used. What do they represent?

I have tried both RGB and Grayscale images. Is there some theory I am missing and can't get that to work?

Gaussian 2D equation which one to choose ?

Hi,
A question about gaussian.java
The equation of Function2D is written :
Math.exp(-(x * x + y * y) / (2 * sqrSigma))
But according to wikipedia
Shouldn't it be:
Math.exp(-(x * x + y * y) / (2 * sqrSigma))/(2*Math.PI*sqrSigma)

Thank you for the framework, Vincent

Line Removal from Scanned Document

Hello,
I am trying to find a way to remove horizontala and vertical lines from scanned Documents, to have better results with Tessercat. I tried with Hough, but I am getting lost...
It would be great to have some hints!

Thnaks in avance
bi2780_pg3_displayimage

Float FastBitmap

Hi all,
I'm playing with this framework with good results. In particular I'm using the clahe filter to enhance my images. Unfortunately my images are satellite data that comes as 16bits unsigned short (from 0 to 65535 per band) or 32bit float (from 0 to 1).

So I had to manually convert the image to 8 bit before applying the filter. Do you have any plan in the future to handle directly those type of images?
I've tried looking into the code myself but it appears not to be an easy task.

Thank you for all your work!

Separable convolution

Hello Diego,
using Sauvola Threshold filter i found that process gets stuck when the SeparableConvolution is executed. I'm applying it on an image with a resolution of about 2500x1500 and the process never ends because all the iterations SeparableConvolution performs.

Was this filter designed to handle only small resolution images? Or can this be improved for bigger resolutions?

Thanks

Android Image. Can i have a sample code?

Sir, can you help me use your catalano`s framework? I am trying to get the total pixels of an image and cut all the excess space for me to get the total width and height of the used space of the image in an android studio project. Can you please give some sample codes for this? I would really appreciate your help.

How does fastbitmap.setGray affects this.bufferedImage

Hello Sir,
In Catalano.Imaging.Filters, most methods alter
pixelsGray[xstrideX+ystrideY] = (byte) value using FastBitmap.setGray method.
How does pixelsGRAY affects this.bufferedImage in FastBitmap.toIcon/FastBitmap.saveAsJPG?

Also, I am having difficulties displaying images with DataBufferUShort after altering their FBM.pixelsGray[], may I ask if you have any advice to display/save the altered images?

Currently, Ive tried altering FastBitmap.java as follow
private void refresh() {
this.raster = getRaster();

	if (isGrayscale()){
		if (raster.getDataBuffer() instanceof DataBufferByte){
		    pixelsGRAY = ((DataBufferByte) raster.getDataBuffer().getDat
		    a();
		    }
	 else if (raster.getDataBuffer() instanceof DataBufferUShort){
		    pixelData = ((DataBufferUShort) raster.getDataBuffer().getDat
		    a();
		    ByteBuffer byteBuffer = ByteBuffer.allocate(pixelData.length*2);
		    byteBuffer.asShortBuffer().put(ShortBuffer.wrap(pixelData));
		    pixelsGray = byteBuffer.array();
		    
		    }
		}

}

The values in pixelsGray became negative when using invert(), however the this.bufferedImage remains the same.

Zernike moments

Can you please give me an example how to calculate Zernike moments. I did not find any example in the sample folder.
I'm really need it.

Where can I find examples/sample code or documentation on the framework?

I'm trying to use the framework to do some grid detection. So far, I found the BradleyLocalThreshold class, but I'm not sure how I should use it exactly. Also, there are some other things that I want to do like contour detection and Gaussian blurring, is there any general documentation or sample code on image processing that I can look at?

From my limited research, it looks like there used to be samples and documentation in the code.google.com project, but nothing is there anymore and I can't find anything in this repo.

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.