本文整理汇总了Python中qimage2ndarray.byte_view函数的典型用法代码示例。如果您正苦于以下问题:Python byte_view函数的具体用法?Python byte_view怎么用?Python byte_view使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了byte_view函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testEverythingDirtyPropagation
def testEverythingDirtyPropagation( self ):
self.lsm.append(self.layer2)
tiling = Tiling((900,400), blockSize=100)
tp = TileProvider(tiling, self.pump.stackedImageSources)
try:
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == self.CONSTANT))
self.assertTrue(np.all(aimg[:,:,3] == 255))
NEW_CONSTANT = self.CONSTANT+1
self.ds2.constant = NEW_CONSTANT
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == NEW_CONSTANT))
self.assertTrue(np.all(aimg[:,:,3] == 255))
finally:
tp.notifyThreadsToStop()
tp.joinThreads()
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:26,代码来源:tiling_tests.py
示例2: test_alphamodulated2qimage
def test_alphamodulated2qimage():
if not _have_qt:
return
# create test data such that rounding does not depend on the least significant bit
a = (numpy.random.randint(255, size=(100,200)).astype(numpy.float32)+0.25)/255.0-0.5
a[0,0] =-0.5 #make sure we get the correct bounds
a[0,1] = 0.5
vigra.impex.writeImage(a.swapaxes(0,1), "tmp1.png")
tintColor = numpy.asarray([0.0, 1.0, 0.0], dtype=numpy.float32)
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32_Premultiplied)
n = numpy.asarray([-0.5, 0.5], dtype=numpy.float32)
vigra.colors.alphamodulated2qimage_ARGB32Premultiplied(a, byte_view(img), tintColor, n)
tmp1 = vigra.impex.readImage("tmp1.png").view(numpy.ndarray).squeeze().astype(numpy.uint8)
tmp2 = byte_view(img)
tmp2 = tmp2.swapaxes(0,1)
assert_true( tmp1.shape[0:2] == tmp2.shape[0:2] )
assert_true( tmp2.ndim == 3 )
assert_true( tmp2.shape[2] == 4 )
assert_true( (tmp2[:,:,0] == 0).all() )
assert_true( (tmp2[:,:,2] == 0).all() )
assert_true( (tmp2[:,:,3] == tmp1).all() )
assert_true( (tmp2[:,:,1] == tmp1).all() )
开发者ID:DaveRichmond-,项目名称:vigra,代码行数:29,代码来源:test_color.py
示例3: toImage
def toImage( self ):
t = time.time()
tWAIT = time.time()
self._arrayreq.wait()
tWAIT = 1000.0*(time.time()-tWAIT)
tAR = time.time()
a = self._arrayreq.getResult()
tAR = 1000.0*(time.time()-tAR)
assert a.ndim == 2, "GrayscaleImageRequest.toImage(): result has shape %r, which is not 2-D" % (a.shape,)
normalize = self._normalize
if not normalize:
normalize = [0,255]
# FIXME: It is obviously wrong to truncate like this (right?)
if a.dtype == np.uint64 or a.dtype == np.int64:
warnings.warn("Truncating 64-bit pixels for display")
if a.dtype == np.uint64:
a = a.astype( np.uint32 )
elif a.dtype == np.int64:
a = a.astype( np.int32 )
#
# new conversion
#
tImg = None
if _has_vigra and hasattr(vigra.colors, 'gray2qimage_ARGB32Premultiplied'):
if self._normalize is None or \
self._normalize[0] >= self._normalize[1] or \
self._normalize == [0, 0]: #FIXME: fix volumina conventions
n = np.asarray([0, 255], dtype=a.dtype)
else:
n = np.asarray(self._normalize, dtype=a.dtype)
tImg = time.time()
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32_Premultiplied)
if not a.flags['C_CONTIGUOUS']:
a = a.copy()
vigra.colors.gray2qimage_ARGB32Premultiplied(a, byte_view(img), n)
tImg = 1000.0*(time.time()-tImg)
else:
self.logger.warning("using slow image creation function")
tImg = time.time()
if self._normalize:
#clipping has been implemented in this commit,
#but it is not yet available in the packages obtained via easy_install
#http://www.informatik.uni-hamburg.de/~meine/hg/qimage2ndarray/diff/fcddc70a6dea/qimage2ndarray/__init__.py
a = np.clip(a, *self._normalize)
img = gray2qimage(a, self._normalize)
ret = img.convertToFormat(QImage.Format_ARGB32_Premultiplied)
tImg = 1000.0*(time.time()-tImg)
if self.logger.getEffectiveLevel() >= logging.DEBUG:
tTOT = 1000.0*(time.time()-t)
self.logger.debug("toImage (%dx%d, normalize=%r) took %f msec. (array req: %f, wait: %f, img: %f)" % (img.width(), img.height(), normalize, tTOT, tAR, tWAIT, tImg))
return img
开发者ID:chaubold,项目名称:volumina,代码行数:59,代码来源:imagesources.py
示例4: renderScene
def renderScene( self, s):
img = QImage(310,290,QImage.Format_ARGB32_Premultiplied)
p = QPainter(img)
s.render(p)
s.joinRendering()
s.render(p)
p.end()
return byte_view(img)
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:8,代码来源:imageScene2D_tests.py
示例5: test_byte_view_rgb32
def test_byte_view_rgb32():
qimg = QtGui.QImage(320, 240, QtGui.QImage.Format_RGB32)
v = qimage2ndarray.byte_view(qimg)
qimg.fill(23)
qimg.setPixel(12, 10, 42)
assert_equal(v.shape, (240, 320, 4))
assert_equal(list(v[10,10]), [23, 0, 0, 0xff])
assert_equal(list(v[10,12]), [42, 0, 0, 0xff])
assert_equal(v.nbytes, numBytes(qimg))
开发者ID:christwell,项目名称:qimage2ndarray,代码行数:9,代码来源:test_qimage_views.py
示例6: test_byte_view_indexed
def test_byte_view_indexed():
qimg = QtGui.QImage(320, 240, QtGui.QImage.Format_Indexed8)
setNumColors(qimg, 256)
v = qimage2ndarray.byte_view(qimg)
qimg.fill(23)
qimg.setPixel(12, 10, 42)
assert_equal(v.shape, (240, 320, 1))
assert_equal(list(v[10,10]), [23])
assert_equal(list(v[10,12]), [42])
assert_equal(v.nbytes, numBytes(qimg))
开发者ID:christwell,项目名称:qimage2ndarray,代码行数:10,代码来源:test_qimage_views.py
示例7: renderScene
def renderScene( self, s, exportFilename=None):
img = QImage(310,290,QImage.Format_ARGB32_Premultiplied)
p = QPainter(img)
s.render(p)
s.joinRendering()
s.render(p)
p.end()
if exportFilename is not None:
img.save(exportFilename)
return byte_view(img)
开发者ID:DerThorsten,项目名称:volumina,代码行数:10,代码来源:imageScene2D_tests.py
示例8: check
def check(result, codon):
self.assertEqual(codon, "unique")
self.assertTrue(type(result) == QImage)
result_array = qimage2ndarray.byte_view(result)
assert((result_array[:10, :, -1] == 255).all())
assert((result_array[-10:, :, -1] == 255).all())
assert((result_array[:, :10, -1] == 255).all())
assert((result_array[:, -10:, -1] == 255).all())
开发者ID:CVML,项目名称:volumina,代码行数:10,代码来源:imagesources_test.py
示例9: testSetAllLayersInvisible
def testSetAllLayersInvisible( self ):
tiling = Tiling((900,400), blockSize=100)
tp = TileProvider(tiling, self.sims)
try:
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == self.GRAY3))
self.assertTrue(np.all(aimg[:,:,3] == 255))
self.layer1.visible = False
self.layer2.visible = False
self.layer3.visible = False
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == 255)) # all white
self.assertTrue(np.all(aimg[:,:,3] == 255))
self.layer1.visible = False
self.layer2.visible = True
self.layer2.opacity = 1.0
self.layer3.visible = False
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == self.GRAY2))
self.assertTrue(np.all(aimg[:,:,3] == 255))
finally:
tp.notifyThreadsToStop()
tp.joinThreads()
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:38,代码来源:tiling_tests.py
示例10: toImage
def toImage(self):
t = time.time()
tWAIT = time.time()
self._arrayreq.wait()
tWAIT = 1000.0 * (time.time() - tWAIT)
tAR = time.time()
a = self._arrayreq.getResult()
tAR = 1000.0 * (time.time() - tAR)
has_no_mask = not np.ma.is_masked(a)
tImg = None
if has_no_mask and _has_vigra and hasattr(vigra.colors, "gray2qimage_ARGB32Premultiplied"):
if not a.flags.contiguous:
a = a.copy()
tImg = time.time()
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32_Premultiplied)
tintColor = np.asarray(
[self._tintColor.redF(), self._tintColor.greenF(), self._tintColor.blueF()], dtype=np.float32
)
normalize = np.asarray(self._normalize, dtype=np.float32)
if normalize[0] > normalize[1]:
normalize = np.array((0.0, 255.0)).astype(np.float32)
vigra.colors.alphamodulated2qimage_ARGB32Premultiplied(a, byte_view(img), tintColor, normalize)
tImg = 1000.0 * (time.time() - tImg)
else:
if has_no_mask:
self.logger.warning("using unoptimized conversion functions")
tImg = time.time()
d = a[..., None].repeat(4, axis=-1)
d[:, :, 0] = d[:, :, 0] * self._tintColor.redF()
d[:, :, 1] = d[:, :, 1] * self._tintColor.greenF()
d[:, :, 2] = d[:, :, 2] * self._tintColor.blueF()
normalize = self._normalize
img = array2qimage(d, normalize)
img = img.convertToFormat(QImage.Format_ARGB32_Premultiplied)
tImg = 1000.0 * (time.time() - tImg)
if self.logger.isEnabledFor(logging.DEBUG):
tTOT = 1000.0 * (time.time() - t)
self.logger.debug(
"toImage (%dx%d, normalize=%r) took %f msec. (array req: %f, wait: %f, img: %f)"
% (img.width(), img.height(), normalize, tTOT, tAR, tWAIT, tImg)
)
return img
开发者ID:ilastik,项目名称:volumina,代码行数:49,代码来源:imagesources.py
示例11: renderScene
def renderScene( self, s, exportFilename=None, joinRendering=True):
img = QImage(30,30,QImage.Format_ARGB32_Premultiplied)
img.fill(Qt.white)
p = QPainter(img)
s.render(p) #trigger a rendering of the whole scene
if joinRendering:
#wait for all the data to arrive
s.joinRendering()
#finally, render everything
s.render(p)
p.end()
if exportFilename is not None:
img.save(exportFilename)
return byte_view(img)
开发者ID:JensNRAD,项目名称:volumina,代码行数:16,代码来源:lazy_test.py
示例12: toImage
def toImage( self ):
t = time.time()
tWAIT = time.time()
self._arrayreq.wait()
tWAIT = 1000.0*(time.time()-tWAIT)
tAR = time.time()
a = self._arrayreq.getResult()
tAR = 1000.0*(time.time()-tAR)
tImg = None
if _has_vigra and hasattr(vigra.colors, 'gray2qimage_ARGB32Premultiplied'):
if not a.flags.contiguous:
a = a.copy()
tImg = time.time()
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32_Premultiplied)
tintColor = np.asarray([self._tintColor.redF(), self._tintColor.greenF(), self._tintColor.blueF()], dtype=np.float32);
normalize = np.asarray(self._normalize, dtype=a.dtype)
if normalize[0] > normalize[1]:
normalize = None
vigra.colors.alphamodulated2qimage_ARGB32Premultiplied(a, byte_view(img), tintColor, normalize)
tImg = 1000.0*(time.time()-tImg)
else:
self.logger.warning("using unoptimized conversion functions")
tImg = time.time()
shape = a.shape + (4,)
d = np.empty(shape, dtype=np.float32)
d[:,:,0] = a[:,:]*self._tintColor.redF()
d[:,:,1] = a[:,:]*self._tintColor.greenF()
d[:,:,2] = a[:,:]*self._tintColor.blueF()
d[:,:,3] = a[:,:]
normalize = self._normalize
img = array2qimage(d, normalize)
img = img.convertToFormat(QImage.Format_ARGB32_Premultiplied)
tImg = 1000.0*(time.time()-tImg)
if self.logger.getEffectiveLevel() >= logging.DEBUG:
tTOT = 1000.0*(time.time()-t)
self.logger.debug("toImage (%dx%d, normalize=%r) took %f msec. (array req: %f, wait: %f, img: %f)" % (img.width(), img.height(), normalize, tTOT, tAR, tWAIT, tImg))
return img
return img
开发者ID:JensNRAD,项目名称:volumina,代码行数:44,代码来源:imagesources.py
示例13: test_gray2qimage
def test_gray2qimage():
if not _have_qt:
return
# create test data such that rounding does not depend on the least significant bit
a = (numpy.random.randint(255, size=(100,200)).astype(numpy.float32)+0.25)/255.0-0.5
a[0,0] =-0.5 #make sure we get the correct bounds
a[0,1] = 0.5
vigra.impex.writeImage(a.swapaxes(0,1), "tmp1.png")
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32_Premultiplied)
n = numpy.asarray([-0.5, 0.5], dtype=numpy.float32)
vigra.colors.gray2qimage_ARGB32Premultiplied(a, byte_view(img), n)
img.save("tmp2.png")
tmp1 = vigra.impex.readImage("tmp1.png")
tmp2 = vigra.impex.readImage("tmp2.png")
for i in range(3):
assert_true( (tmp1 == tmp2[:,:,i]).all() )
assert_true( (tmp2[:,:,3] == 255).all() )
开发者ID:DaveRichmond-,项目名称:vigra,代码行数:21,代码来源:test_color.py
示例14: ObjDetect
def ObjDetect(self):
eightbit = QImage.convertToFormat(self._image, QImage.Format_Indexed8)
eightbit = qim.byte_view(eightbit)
eightbit = cv2.medianBlur(eightbit, 19)
thr = cv2.adaptiveThreshold(eightbit, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)
#ret, thr = cv2.threshold(eightbit, 127, 255, cv2.THRESH_BINARY)
cv2.imshow("NAO", thr)
k = cv2.waitKey(100) & 0xff
if k == 27:
cv2.destroyAllWindows()
sys.exit(app.exec_())
contours0, hierarchy = cv2.findContours(thr, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
print len(contours0)
for cnt in contours0[0]:
contours = cv2.approxPolyDP(cnt, cv2.arcLength(contours0, True), True)
#contours = cv2.approxPolyDP(contours, .01 * cv2.arcLength(contours, True), True)
self._array = cv2.drawContours(self._array, [cnt], 0, (255, 0, 0), 2)
cv2.imshow("NAO", self._array)
k = cv2.waitKey(100) & 0xff
if k == 27:
cv2.destroyAllWindows()
sys.exit(app.exec_())
开发者ID:sarabirdy,项目名称:research,代码行数:22,代码来源:obj_detect_nao.py
示例15: toImage
def toImage( self ):
a = self._arrayreq.getResult()
assert a.ndim == 2
# Use vigra if possible (much faster)
if _has_vigra and hasattr(vigra.colors, 'applyColortable'):
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32)
vigra.colors.applyColortable(a, self._colorTable, byte_view(img))
# Without vigra, do it the slow way
else:
if _has_vigra:
# If this warning is annoying you, try this:
# warnings.filterwarnings("once")
warnings.warn("Using slow colortable images. Upgrade to VIGRA > 1.9 to use faster implementation.")
#make sure that a has values in range [0, colortable_length)
a = np.remainder(a, len(self._colorTable))
#apply colortable
colortable = np.roll(np.fliplr(self._colorTable), -1, 1) # self._colorTable is BGRA, but array2qimage wants RGBA
img = colortable[a]
img = array2qimage(img)
return img
开发者ID:buotex,项目名称:volumina,代码行数:24,代码来源:imagesources.py
示例16: testOutOfViewDirtyPropagation
def testOutOfViewDirtyPropagation( self ):
self.lsm.append(self.layer1)
tiling = Tiling((900,400), blockSize=100)
tp = TileProvider(tiling, self.pump.stackedImageSources)
try:
# Navigate down to the second z-slice
self.pump.syncedSliceSources.through = [0,1,0]
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
# Sanity check: Do we see the right data on the second slice? (should be all 1s)
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == 1))
self.assertTrue(np.all(aimg[:,:,3] == 255))
# Navigate down to the third z-slice
self.pump.syncedSliceSources.through = [0,2,0]
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
# Sanity check: Do we see the right data on the third slice?(should be all 2s)
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == 2))
self.assertTrue(np.all(aimg[:,:,3] == 255))
# Navigate back up to the second z-slice
self.pump.syncedSliceSources.through = [0,1,0]
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
for tile in tiles:
aimg = byte_view(tile.qimg)
self.assertTrue(np.all(aimg[:,:,0:3] == 1))
self.assertTrue(np.all(aimg[:,:,3] == 255))
# Change some of the data in the (out-of-view) third z-slice
slicing = (slice(None), slice(100,300), slice(100,300), slice(2,3), slice(None))
slicing = tuple(slicing)
self.ds1._array[slicing] = 99
self.ds1.setDirty( slicing )
# Navigate back down to the third z-slice
self.pump.syncedSliceSources.through = [0,2,0]
tp.requestRefresh(QRectF(100,100,200,200))
tp.join()
# Even though the data was out-of-view when it was changed, it should still have new values.
# If dirtiness wasn't propagated correctly, the cache's old values will be used.
# (For example, this fails if you comment out the call to setDirty, above.)
tiles = tp.getTiles(QRectF(100,100,200,200))
for tile in tiles:
aimg = byte_view(tile.qimg)
# Use any() because the tile borders may not be perfectly aligned with the data we changed.
self.assertTrue(np.any(aimg[:,:,0:3] == 99))
finally:
tp.notifyThreadsToStop()
tp.joinThreads()
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:61,代码来源:tiling_tests.py
示例17: test_byte_view
def test_byte_view():
for filename in all_test_images:
assert isinstance(qimage2ndarray.byte_view(filename), numpy.ndarray)
开发者ID:DerThorsten,项目名称:qimage2ndarray,代码行数:3,代码来源:test_implicit_imread.py
示例18: toImage
def toImage( self ):
t = time.time()
tWAIT = time.time()
self._arrayreq.wait()
tWAIT = 1000.0*(time.time()-tWAIT)
tAR = time.time()
a = self._arrayreq.getResult()
tAR = 1000.0*(time.time()-tAR)
assert a.ndim == 2
if self._normalize and self._normalize[0] < self._normalize[1]:
nmin, nmax = self._normalize
if nmin:
a = a - nmin
scale = (len(self._colorTable)-1) / float(nmax - nmin + 1e-35) #if max==min
if scale != 1.0:
a = a * scale
if len(self._colorTable) <= 2**8:
a = np.asanyarray( a, dtype=np.uint8 )
elif len(self._colorTable) <= 2**16:
a = np.asanyarray( a, dtype=np.uint16 )
elif len(self._colorTable) <= 2**32:
a = np.asanyarray( a, dtype=np.uint32 )
# Use vigra if possible (much faster)
tImg = None
if _has_vigra and hasattr(vigra.colors, 'applyColortable'):
tImg = time.time()
img = QImage(a.shape[1], a.shape[0], QImage.Format_ARGB32)
if not issubclass( a.dtype.type, np.integer ):
raise NotImplementedError()
#FIXME: maybe this should be done in a better way using an operator before the colortable request which properly handles
#this problem
warnings.warn("Data for colortable layers cannot be float, casting",RuntimeWarning)
a = np.asanyarray(a, dtype=np.uint32)
# If we have a masked array with a non-trivial mask, ensure that mask is made transparent.
_colorTable = self._colorTable
if np.ma.is_masked(a):
# Add transparent color at the beginning of the colortable as needed.
if (_colorTable[0, 3] != 0):
# If label 0 is unused, it can be transparent. Otherwise, the transparent color must be inserted.
if (a.min() == 0):
# If it will overflow simply promote the type. Unless we have reached the max VIGRA type.
if (a.max() == np.iinfo(a.dtype).max):
a_new_dtype = np.min_scalar_type(np.iinfo(a.dtype).max + 1)
if a_new_dtype <= np.dtype(np.uint32):
a = np.asanyarray(a, dtype=a_new_dtype)
else:
assert (np.iinfo(a.dtype).max >= len(_colorTable)), \
"This is a very large colortable. If it is indeed needed, add a transparent" + \
" color at the beginning of the colortable for displaying masked arrays."
# Try to wrap the max value to a smaller value of the same color.
a[a == np.iinfo(a.dtype).max] %= len(_colorTable)
# Insert space for transparent color and shift labels up.
_colorTable = np.insert(_colorTable, 0, 0, axis=0)
a += 1
else:
# Make sure the first color is transparent.
_colorTable = _colorTable.copy()
_colorTable[0] = 0
# Make masked values transparent.
a = np.ma.filled(a, 0)
vigra.colors.applyColortable(a, _colorTable, byte_view(img))
tImg = 1000.0*(time.time()-tImg)
# Without vigra, do it the slow way
else:
raise NotImplementedError()
if _has_vigra:
# If this warning is annoying you, try this:
# warnings.filterwarnings("once")
warnings.warn("Using slow colortable images. Upgrade to VIGRA > 1.9 to use faster implementation.")
#make sure that a has values in range [0, colortable_length)
a = np.remainder(a, len(self._colorTable))
#apply colortable
colortable = np.roll(np.fliplr(self._colorTable), -1, 1) # self._colorTable is BGRA, but array2qimage wants RGBA
img = colortable[a]
img = array2qimage(img)
if self.logger.getEffectiveLevel() >= logging.DEBUG:
tTOT = 1000.0*(time.time()-t)
self.logger.debug("toImage (%dx%d) took %f msec. (array req: %f, wait: %f, img: %f)" % (img.width(), img.height(), tTOT, tAR, tWAIT, tImg))
return img
开发者ID:CVML,项目名称:volumina,代码行数:93,代码来源:imagesources.py
示例19: test_scalar2qimage_normalize_dont_touch_0_255
def test_scalar2qimage_normalize_dont_touch_0_255():
a = numpy.zeros((100, 256), dtype = float)
a[:] = numpy.arange(256)
qImg = qimage2ndarray.array2qimage(a, normalize = True)
b = qimage2ndarray.byte_view(qImg)
assert numpy.all(a == b[...,0])
开发者ID:christwell,项目名称:qimage2ndarray,代码行数:6,代码来源:test_array2qimage.py
注:本文中的qimage2ndarray.byte_view函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论