This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package radon; | |
import java.util.function.DoubleBinaryOperator; | |
import hageldave.imagingkit.core.Img; | |
import hageldave.imagingkit.core.io.ImageLoader; | |
import hageldave.imagingkit.core.io.ImageSaver; | |
import hageldave.imagingkit.core.scientific.ColorImg; | |
import hageldave.imagingkit.core.util.ImageFrame; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Semaphore; | |
import java.util.concurrent.atomic.AtomicBoolean; | |
/** | |
* This class is a utility class for exception safe usage of a semaphore. | |
* When returns {@code semaphore.acquire() } the current thread successfully entered the | |
* critical region but it has to call {@code semaphore.release() } on exit to make room | |
* for other threads to enter the critical region. | |
* If this call is not guaranteed, thread starvation can occur (or even deadlock) since |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ezLinalg; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
import java.util.function.BiFunction; | |
import java.util.function.BinaryOperator; | |
import java.util.function.DoubleBinaryOperator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hageldave.imagingkit.core; | |
import java.awt.BasicStroke; | |
import java.awt.Color; | |
import java.util.Arrays; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ConcurrentLinkedQueue; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.function.Consumer; | |
import java.util.function.DoubleFunction; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static byte[] saveImgToBytes(Img img) { | |
int w = img.getWidth(); | |
int h = img.getHeight(); | |
int n = img.numValues(); | |
int length = n*4 + 4+4; | |
byte[] b = new byte[length]; | |
// save width | |
int i = 0; | |
b[i++] = signedByteToByte(w); | |
b[i++] = signedByteToByte(w>>8); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hageldave.imagingkit.core.ImageLoader; | |
import hageldave.imagingkit.core.Img; | |
import hageldave.imagingkit.core.util.ImageFrame; | |
import hageldave.imagingkit.filter.implementations.ConvolutionFilter; | |
public class testmain { | |
public static void main(String[] args) throws InterruptedException { | |
Img img = ImageLoader.loadImgFromURL("http://www.wellcomeimageawards.org/WI-6561.24_WIA_2017_PP_holding_screen.jpg"); | |
ConvolutionFilter c = new ConvolutionFilter(); | |
float[] kernel = new float[17*17]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package misc; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.PrintStream; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.Scanner; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package misc; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.Spliterator; | |
import java.util.function.Consumer; | |
import java.util.stream.Stream; | |
import java.util.stream.StreamSupport; | |
public class Slice<T> implements Iterable<Slice.ArrayAccessor<T>>{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
Img img1 = new Img(4000, 4000); | |
Img img2 = new Img(4000, 4000) { | |
@Override | |
public Pixel getPixel() { | |
return new Pixol(this, 0); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
Img img = new Img(200,200); | |
img.fill(0xff000000); | |
Spliterator<float[]> split = new ConvertedPixelSpliterator<>( | |
img.spliterator(), | |
()->{return new float[6];}, | |
testmain::pixel2vec, | |
testmain::vec2Pixel); |