File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed
src/test/java/org/scijava/ops/opencv Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 187187 <version >${project.version} </version >
188188 <scope >test</scope >
189189 </dependency >
190- <dependency >
191- <groupId >org.scijava</groupId >
192- <artifactId >scijava-io-http</artifactId >
193- <scope >test</scope >
194- </dependency >
195- <dependency >
196- <groupId >io.scif</groupId >
197- <artifactId >scifio</artifactId >
198- <scope >test</scope >
199- </dependency >
200190 </dependencies >
201191</project >
Original file line number Diff line number Diff line change 2929
3030package org .scijava .ops .opencv ;
3131
32- import io .scif .img .IO ;
3332import net .imagej .opencv .MatToImgConverter ;
3433import net .imglib2 .img .Img ;
34+ import net .imglib2 .img .array .ArrayImgs ;
3535import org .bytedeco .opencv .opencv_core .Mat ;
3636import org .bytedeco .opencv .opencv_core .Size ;
3737import org .junit .jupiter .api .Test ;
@@ -183,7 +183,8 @@ public void testUsage() {
183183 @ Test
184184 public void testImgToMat () {
185185 OpEnvironment ops = OpEnvironment .build ();
186- Img <?> src = IO .open ("https://imagej.net/images/lymp.tif" );
186+ int w = 130 , h = 130 ;
187+ Img <?> src = ArrayImgs .unsignedBytes (randomBytes (w * h ), w , h );
187188 Img <?> dest = src .copy ();
188189 int stDev = 100 ;
189190 Size size = new Size (5 , 5 );
@@ -223,4 +224,17 @@ private Mat openFish() {
223224 return imread (new File (getClass ().getResource ("/HappyFish.jpg" ).getFile ())
224225 .getAbsolutePath ());
225226 }
227+
228+ private byte [] randomBytes (int length ) {
229+ byte [] data = new byte [length ];
230+ data [0 ] = 123 ;
231+ for (int i = 1 ; i < data .length ; i ++) {
232+ int d = data [i - 1 ];
233+ d ^= d >> 12 ;
234+ d ^= d << 25 ;
235+ d ^= d >> 27 ;
236+ data [i ] = (byte ) d ;
237+ }
238+ return data ;
239+ }
226240}
You can’t perform that action at this time.
0 commit comments