text stringlengths 81 112k |
|---|
weights see
https://en.wikipedia.org/wiki/Grayscale#Colorimetric_.28luminance-prese
http://docs.opencv.org/2.4/modules/imgproc/doc/miscellaneous_transformations.html#cvtcolor
def toGray(img):
'''
weights see
https://en.wikipedia.org/wiki/Grayscale#Colorimetric_.28luminance-prese
http://do... |
returns the normalized RGB space (RGB/intensity)
see https://en.wikipedia.org/wiki/Rg_chromaticity
def rgChromaticity(img):
'''
returns the normalized RGB space (RGB/intensity)
see https://en.wikipedia.org/wiki/Rg_chromaticity
'''
out = _calc(img)
if img.dtype == np.uint8:
o... |
TODO##########
def monochromaticWavelength(img):
'''
TODO##########
'''
# peak wave lengths: https://en.wikipedia.org/wiki/RGB_color_model
out = _calc(img)
peakWavelengths = (570, 540, 440) # (r,g,b)
# s = sum(peakWavelengths)
for n, p in enumerate(peakWavelengths):
... |
rotate one or multiple grayscale or color images 90 degrees
def rot90(img):
'''
rotate one or multiple grayscale or color images 90 degrees
'''
s = img.shape
if len(s) == 3:
if s[2] in (3, 4): # color image
out = np.empty((s[1], s[0], s[2]), dtype=img.dtype)
... |
like cv2.applyColorMap(im_gray, cv2.COLORMAP_*) but with different color maps
def applyColorMap(gray, cmap='flame'):
'''
like cv2.applyColorMap(im_gray, cv2.COLORMAP_*) but with different color maps
'''
# TODO:implement more cmaps
if cmap != 'flame':
raise NotImplemented
# TODO: ... |
returns the index to insert the given date in a list
where each items first value is a date
def _insertDateIndex(date, l):
'''
returns the index to insert the given date in a list
where each items first value is a date
'''
return next((i for i, n in enumerate(l) if n[0] < date), len(l)) |
returns the index of given or best fitting date
def _getFromDate(l, date):
'''
returns the index of given or best fitting date
'''
try:
date = _toDate(date)
i = _insertDateIndex(date, l) - 1
if i == -1:
return l[0]
return l[i]
except (ValueError... |
Args:
typ: type of calibration to look for. See .coeffs.keys() for all types available
light (Optional[str]): restrict to calibrations, done given light source
Returns:
list: All calibration dates available for given typ
def dates(self, typ, light=None):
'''
... |
Args:
typ: type of calibration to look for. See .coeffs.keys() for all types available
date (Optional[str]): date of calibration
Returns:
list: all infos available for given typ
def infos(self, typ, light=None, date=None):
'''
Args:
typ: ... |
Returns:
str: an overview covering all calibrations
infos and shapes
def overview(self):
'''
Returns:
str: an overview covering all calibrations
infos and shapes
'''
c = self.coeffs
out = 'camera name: %s' % c['name']
... |
Args:
camera_name (str): Name of the camera
bit_depth (int): depth (bit) of the camera sensor
def setCamera(self, camera_name, bit_depth=16):
'''
Args:
camera_name (str): Name of the camera
bit_depth (int): depth (bit) of the camera sensor
... |
Args:
slope (np.array)
intercept (np.array)
error (numpy.array)
slope (float): dPx/dExposureTime[sec]
error (float): absolute
date (str): "DD Mon YY" e.g. "30 Nov 16"
def addDarkCurrent(self, slope, intercept=None, date=None, info='', error=... |
Args:
nlf_coeff (list)
error (float): absolute
info (str): additional information
date (str): "DD Mon YY" e.g. "30 Nov 16"
def addNoise(self, nlf_coeff, date=None, info='', error=None):
'''
Args:
nlf_coeff (list)
error (flo... |
add a new point spread function
def addPSF(self, psf, date=None, info='', light_spectrum='visible'):
'''
add a new point spread function
'''
self._registerLight(light_spectrum)
date = _toDate(date)
f = self.coeffs['psf']
if light_spectrum not in f:
... |
light_spectrum = light, IR ...
def addFlatField(self, arr, date=None, info='', error=None,
light_spectrum='visible'):
'''
light_spectrum = light, IR ...
'''
self._registerLight(light_spectrum)
self._checkShape(arr)
date = _toDate(date)
... |
lens -> instance of LensDistortion or saved file
def addLens(self, lens, date=None, info='', light_spectrum='visible'):
'''
lens -> instance of LensDistortion or saved file
'''
self._registerLight(light_spectrum)
date = _toDate(date)
if not isinstance(lens, LensD... |
if not only a specific date than remove all except of the youngest calibration
def clearOldCalibrations(self, date=None):
'''
if not only a specific date than remove all except of the youngest calibration
'''
self.coeffs['dark current'] = [self.coeffs['dark current'][-1]]
s... |
transpose all calibration arrays
in case different array shape orders were used (x,y) vs. (y,x)
def transpose(self):
'''
transpose all calibration arrays
in case different array shape orders were used (x,y) vs. (y,x)
'''
def _t(item):
if type(item) == ... |
exposure_time [s]
date -> string e.g. '30. Nov 15' to get a calibration on from date
-> {'dark current':'30. Nov 15',
'flat field':'15. Nov 15',
'lens':'14. Nov 15',
'noise':'01. Nov 15'}
def correct(self, images,
bgImages=... |
denoise using non-local-means
with guessing best parameters
def _correctNoise(self, image):
'''
denoise using non-local-means
with guessing best parameters
'''
from skimage.restoration import denoise_nl_means # save startup time
image[np.isnan(image)] = 0... |
open OR calculate a background image: f(t)=m*t+n
def _correctDarkCurrent(self, image, exposuretime, bgImages, date):
'''
open OR calculate a background image: f(t)=m*t+n
'''
# either exposureTime or bgImages has to be given
# if exposuretime is not None or bgImages is not N... |
Apply a thresholded median replacing high gradients
and values beyond the boundaries
def _correctArtefacts(self, image, threshold):
'''
Apply a thresholded median replacing high gradients
and values beyond the boundaries
'''
image = np.nan_to_num(image)
... |
try to get calibration for right light source, but
use another if they is none existent
def getCoeff(self, name, light=None, date=None):
'''
try to get calibration for right light source, but
use another if they is none existent
'''
d = self.coeffs[name]
... |
important: first image should shown most iof the device
because it is used as reference
def vignettingFromRandomSteps(imgs, bg, inPlane_scale_factor=None,
debugFolder=None, **kwargs):
'''
important: first image should shown most iof the device
because it is used as re... |
Args:
img (path or array): image containing the same object as in the reference image
Kwargs:
maxShear (float): In order to define a good fit, refect higher shear values between
this and the reference image
maxRot (float): Same for rotation
... |
calculate the standard deviation of all fitted images,
averaged to a grid
def error(self, nCells=15):
'''
calculate the standard deviation of all fitted images,
averaged to a grid
'''
s0, s1 = self.fits[0].shape
aR = s0 / s1
if aR > 1:
... |
fit perspective and size of the input image to the reference image
def _fitImg(self, img):
'''
fit perspective and size of the input image to the reference image
'''
img = imread(img, 'gray')
if self.bg is not None:
img = cv2.subtract(img, self.bg)
i... |
Create a bounding box around the object within an image
def _findObject(self, img):
'''
Create a bounding box around the object within an image
'''
from imgProcessor.imgSignal import signalMinimum
# img is scaled already
i = img > signalMinimum(img) # img.max()/2.... |
Remove vertical lines in boolean array if linelength >=min_line_length
def filterVerticalLines(arr, min_line_length=4):
"""
Remove vertical lines in boolean array if linelength >=min_line_length
"""
gy = arr.shape[0]
gx = arr.shape[1]
mn = min_line_length-1
for i in range(gy):
... |
Vignetting equation using the KANG-WEISS-MODEL
see http://research.microsoft.com/en-us/um/people/sbkang/publications/eccv00.pdf
f - focal length
alpha - coefficient in the geometric vignetting factor
tilt - tilt angle of a planar scene
rot - rotation angle of a planar scene
cx - image... |
this function is extra to only cover vignetting through perspective distortion
f - focal length [px]
tau - tilt angle of a planar scene [radian]
rot - rotation angle of a planar scene [radian]
def tiltFactor(xy, f, tilt, rot, center=None):
'''
this function is extra to only cover vignetting ... |
returns an image average
works on many, also unloaded images
minimises RAM usage
def imgAverage(images, copy=True):
'''
returns an image average
works on many, also unloaded images
minimises RAM usage
'''
i0 = images[0]
out = imread(i0, dtype='float')
if copy and i... |
Imagine you have cell averages [grid] on an image.
the top-left position of [grid] within the image
can be variable [offset]
offset(x,y)
e.g.(0,0) if no offset
grid(nx,ny) resolution of smaller grid
shape(x,y) -> output shape
returns meshgrid to be used to upscale [... |
Poisson function
a -> height of the curve's peak
b -> position of the center of the peak
c -> standard deviation
d -> offset
def poisson(x, a, b, c, d=0):
'''
Poisson function
a -> height of the curve's peak
b -> position of the center of the peak
c -> standard deviation... |
angle [deg]
def rotate(image, angle, interpolation=cv2.INTER_CUBIC,
borderMode=cv2.BORDER_REFLECT, borderValue=0):
'''
angle [deg]
'''
s0, s1 = image.shape
image_center = (s0 - 1) / 2., (s1 - 1) / 2.
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2... |
Adjust image uncertainty (measured at exposure time t0)
to new exposure time
facExpTime --> new exp.time / reference exp.time =(t/t0)
uncertMap --> 2d array mapping image uncertainty
evtLen --> 2d array mapping event duration within image [sec]
event duration is relative... |
a -> height of the curve's peak
b -> position of the center of the peak
c -> standard deviation or Gaussian RMS width
d -> offset
def gaussian(x, a, b, c, d=0):
'''
a -> height of the curve's peak
b -> position of the center of the peak
c -> standard deviation or Gaussian RMS widt... |
TODO
def videoWrite(path, imgs, levels=None, shape=None, frames=15,
annotate_names=None,
lut=None, updateFn=None):
'''
TODO
'''
frames = int(frames)
if annotate_names is not None:
assert len(annotate_names) == len(imgs)
if levels is None:
... |
dtype = 'noUint', uint8, float, 'float', ...
def imread(img, color=None, dtype=None):
'''
dtype = 'noUint', uint8, float, 'float', ...
'''
COLOR2CV = {'gray': cv2.IMREAD_GRAYSCALE,
'all': cv2.IMREAD_COLOR,
None: cv2.IMREAD_ANYCOLOR
}
c = COLOR... |
img - background, flat field, ste corrected image
roi - [(x1,y1),...,(x4,y4)] - boundaries where points are
def addImg(self, img, roi=None):
'''
img - background, flat field, ste corrected image
roi - [(x1,y1),...,(x4,y4)] - boundaries where points are
'''
self.i... |
FASTER IMPLEMENTATION OF interpolate2dStructuredIDW
replace all values in [grid] indicated by [mask]
with the inverse distance weighted interpolation of all values within
px+-kernel
[power] -> distance weighting factor: 1/distance**[power]
[minvals] -> minimum number of neighbour values to ... |
Stitch 2 images vertically together.
Smooth the overlap area of both images with a linear fade from img1 to img2
@param img1: numpy.2dArray
@param img2: numpy.2dArray of the same shape[1,2] as img1
@param overlap: number of pixels both images overlap
@returns: stitched-image
def linearBlend(... |
same as interpolate2dStructuredIDW but using the point spread method
this is faster if there are bigger connected masked areas and the border
length is smaller
replace all values in [grid] indicated by [mask]
with the inverse distance weighted interpolation of all values within
px+-kernel
... |
average a signal-to-noise map
:param method: ['average','X75', 'RMS', 'median'] - X75: this SNR will be exceeded by 75% of the signal
:type method: str
:param checkBackground: check whether there is actually a background level to exclude
:type checkBackground: bool
:returns: averaged SNR as ... |
same as scipy.ndimage.convolve but is only executed on mask==True
... which should speed up everything
def maskedConvolve(arr, kernel, mask, mode='reflect'):
'''
same as scipy.ndimage.convolve but is only executed on mask==True
... which should speed up everything
'''
arr2 = extendArrayFo... |
Returns a signal-to-noise-map
uses algorithm as described in BEDRICH 2016 JPV (not jet published)
:param constant_noise_level: True, to assume noise to be constant
:param imgs_to_be_averaged: True, if SNR is for average(img1, img2)
def SNR(img1, img2=None, bg=None,
noise_level_function=None,
... |
sort the corners of a given quadrilateral of the type
corners : [ [xi,yi],... ]
to an anti-clockwise order starting with the bottom left corner
or (if plotted as image where y increases to the bottom):
clockwise, starting top left
def sortCorners(corners):
'''
sort the corners of a gi... |
return an array with contains the closest distance to the next positive
value given in arr within a given kernel size
def closestDirectDistance(arr, ksize=30, dtype=np.uint16):
'''
return an array with contains the closest distance to the next positive
value given in arr within a given kernel siz... |
returns an array with contains the closest distance from every pixel
the next position where target == 1
[walls] binary 2darray - e.g. walls in a labyrinth that have to be surrounded in order to get to the target
[target] binary 2darray - positions given by 1
[concentrate_every_n_pixel] often ... |
fills [res] with [distance to next position where target == 1,
x coord.,
y coord. of that position in target]
using region growth
i,j -> pixel position
growth -> a work array, needed to measure the distance
steps, new_steps -> current and last posit... |
return a list of arrays of un-branching contours
img -> (boolean) array
optional:
---------
minimum_cluster_size -> minimum number of pixels connected together to build a contour
##search_kernel_size -> TODO
##min_search_kernel_moment -> TODO
numeric:
-------------
... |
Return the cumulative density function of a given array or
its intensity at a given position (0-1)
def cdf(arr, pos=None):
'''
Return the cumulative density function of a given array or
its intensity at a given position (0-1)
'''
r = (arr.min(), arr.max())
hist, bin_edges = np.hist... |
Generator to access evenly sized sub-cells in a 2d array
Args:
shape (tuple): number of sub-cells in y,x e.g. (10,15)
d01 (tuple, optional): cell size in y and x
p01 (tuple, optional): position of top left edge
Returns:
int: 1st index
int: 2nd index
array... |
Generator to access evenly sized sub-cells in a 2d array
Args:
shape (tuple): number of sub-cells in y,x e.g. (10,15)
d01 (tuple, optional): cell size in y and x
p01 (tuple, optional): position of top left edge
Returns:
int: 1st index
int: 2nd index
slice... |
Same as subCell2DSlices but returning coordinates
Example:
g = subCell2DCoords(arr, shape)
for x, y in g:
plt.plot(x, y)
def subCell2DCoords(*args, **kwargs):
'''Same as subCell2DSlices but returning coordinates
Example:
g = subCell2DCoords(arr, shape)
... |
Return array where every cell is the output of a given cell function
Args:
fn (function): ...to be executed on all sub-arrays
Returns:
array: value of every cell equals result of fn(sub-array)
Example:
mx = subCell2DFnArray(myArray, np.max, (10,6) )
- -> here ... |
return the defocus (mm std) through DOF
u -> scene point (depth value)
uf -> in-focus position (the distance at which the scene point should be placed in order to be focused)
f -> focal length
k -> camera dependent constant (transferring blur circle to PSF), 2.335 would be FHWD of 2dgaussian
... |
extends a given array right right border handling
for convolution
-->in opposite to skimage and skipy this function
allows to chose different mode = ('reflect', 'wrap')
in x and y direction
only supports 'warp' and 'reflect' at the moment
def extendArrayForConvolution(arr, kernelXY,
... |
sensorSize_mm - (width, height) [mm] Physical size of the sensor
def calibrate(self, board_size=(8, 6), method='Chessboard', images=[],
max_images=100, sensorSize_mm=None,
detect_sensible=True):
'''
sensorSize_mm - (width, height) [mm] Physical size of the sensor... |
add corner points directly instead of extracting them from
image
points = ( (0,1), (...),... ) [x,y]
def addPoints(self, points, board_size=None):
'''
add corner points directly instead of extracting them from
image
points = ( (0,1), (...),... ) [x,y]
'''
... |
image shape must be known for calculating camera matrix
if method==Manual and addPoints is used instead of addImg
this method must be called before .coeffs are obtained
def setImgShape(self, shape):
'''
image shape must be known for calculating camera matrix
if method==Manu... |
add images using a continous stream
- stop when max number of images is reached
def addImgStream(self, img):
'''
add images using a continous stream
- stop when max number of images is reached
'''
if self.findCount > self.max_images:
raise EnoughImages... |
add one chessboard image for detection lens distortion
def addImg(self, img):
'''
add one chessboard image for detection lens distortion
'''
# self.opts['imgs'].append(img)
self.img = imread(img, 'gray', 'uint8')
didFindCorners, corners = self.method()
... |
get the distortion coeffs in a formated string
def getCoeffStr(self):
'''
get the distortion coeffs in a formated string
'''
txt = ''
for key, val in self.coeffs.items():
txt += '%s = %s\n' % (key, val)
return txt |
draw a grid fitting to the last added image
on this one or an extra image
img == None
==False -> draw chessbord on empty image
==img
def drawChessboard(self, img=None):
'''
draw a grid fitting to the last added image
on this one or an extra image
... |
write the distortion coeffs to file
saveOpts --> Whether so save calibration options (and not just results)
def writeToFile(self, filename, saveOpts=False):
'''
write the distortion coeffs to file
saveOpts --> Whether so save calibration options (and not just results)
'''
... |
read the distortion coeffs from file
def readFromFile(self, filename):
'''
read the distortion coeffs from file
'''
s = dict(np.load(filename))
try:
self.coeffs = s['coeffs'][()]
except KeyError:
#LEGENCY - remove
self.coeffs ... |
points --> list of (x,y) coordinates
def undistortPoints(self, points, keepSize=False):
'''
points --> list of (x,y) coordinates
'''
s = self.img.shape
cam = self.coeffs['cameraMatrix']
d = self.coeffs['distortionCoeffs']
pts = np.asarray(points, dtype=n... |
remove lens distortion from given image
def correct(self, image, keepSize=False, borderValue=0):
'''
remove lens distortion from given image
'''
image = imread(image)
(h, w) = image.shape[:2]
mapx, mapy = self.getUndistortRectifyMap(w, h)
self.img = cv2.re... |
opposite of 'correct'
def distortImage(self, image):
'''
opposite of 'correct'
'''
image = imread(image)
(imgHeight, imgWidth) = image.shape[:2]
mapx, mapy = self.getDistortRectifyMap(imgWidth, imgHeight)
return cv2.remap(image, mapx, mapy, cv2.INTER_LINEA... |
value positions based on
http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#cv.InitUndistortRectifyMap
def getCameraParams(self):
'''
value positions based on
http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#cv.InitUndistortRectifyMa... |
sharpness -> image sharpness // std of Gaussian PSF [px]
returns a list of standard uncertainties for the x and y component:
(1x,2x), (1y, 2y), (intensity:None)
1. px-size-changes(due to deflection)
2. reprojection error
def standardUncertainties(self, sharpness=0.5):
'''... |
takes a binary image (usually a mask)
and returns the edges of the object inside
def edgesFromBoolImg(arr, dtype=None):
'''
takes a binary image (usually a mask)
and returns the edges of the object inside
'''
out = np.zeros_like(arr, dtype=dtype)
_calc(arr, out)
_calc(arr.T, out... |
Draws lines between matching keypoints of two images.
Keypoints not in a matching pair are not drawn.
Places the images side by side in a new image and draws circles
around each keypoint, with line segments connecting matching pairs.
You can tweak the r, thickness, and figsize values as needed.
... |
The pattern comparator need images to be 8 bit
-> find the range of the signal and scale the image
def _scaleTo8bit(self, img):
'''
The pattern comparator need images to be 8 bit
-> find the range of the signal and scale the image
'''
r = scaleSignalCutParams(img, ... |
Find homography of the image through pattern
comparison with the base image
def findHomography(self, img, drawMatches=False):
'''
Find homography of the image through pattern
comparison with the base image
'''
print("\t Finding points...")
# Find points in... |
make circle array
def patCircles(s0):
'''make circle array'''
arr = np.zeros((s0,s0), dtype=np.uint8)
col = 255
for rad in np.linspace(s0,s0/7.,10):
cv2.circle(arr, (0,0), int(round(rad)), color=col,
thickness=-1, lineType=cv2.LINE_AA )
if col:
co... |
make line pattern
def patCrossLines(s0):
'''make line pattern'''
arr = np.zeros((s0,s0), dtype=np.uint8)
col = 255
t = int(s0/100.)
for pos in np.logspace(0.01,1,10):
pos = int(round((pos-0.5)*s0/10.))
cv2.line(arr, (0,pos), (s0,pos), color=col,
thickness... |
make line pattern
def patStarLines(s0):
'''make line pattern'''
arr = np.zeros((s0,s0), dtype=np.uint8)
col = 255
t = int(s0/100.)
for pos in np.linspace(0,np.pi/2,15):
p0 = int(round(np.sin(pos)*s0*2))
p1 = int(round(np.cos(pos)*s0*2))
cv2.line(ar... |
make line pattern
def patSiemensStar(s0, n=72, vhigh=255, vlow=0, antiasing=False):
'''make line pattern'''
arr = np.full((s0,s0),vlow, dtype=np.uint8)
c = int(round(s0/2.))
s = 2*np.pi/(2*n)
step = 0
for i in range(2*n):
p0 = round(c+np.sin(step)*2*s0)
p1 = round(c+np... |
make text pattern
def patText(s0):
'''make text pattern'''
arr = np.zeros((s0,s0), dtype=np.uint8)
s = int(round(s0/100.))
p1 = 0
pp1 = int(round(s0/10.))
for pos0 in np.linspace(0,s0,10):
cv2.putText(arr, 'helloworld', (p1,int(round(pos0))),
cv2.FONT_HERSHE... |
img - boolean array
remove all pixels that have no neighbour
def removeSinglePixels(img):
'''
img - boolean array
remove all pixels that have no neighbour
'''
gx = img.shape[0]
gy = img.shape[1]
for i in range(gx):
for j in range(gy):
if img[i, j]:
... |
same as interpolate2dStructuredIDW
but calculation distance to neighbour using polar coordinates
fr, fphi --> weight factors for radian and radius differences
cx,cy -> polar center of the array e.g. middle->(sx//2+1,sy//2+1)
def interpolateCircular2dStructuredIDW(grid, mask, kernel=15, power=2,
... |
#######
usefull if large empty areas need to be filled
def interpolate2dStructuredCrossAvg(grid, mask, kernel=15, power=2):
'''
#######
usefull if large empty areas need to be filled
'''
vals = np.empty(shape=4, dtype=grid.dtype)
dist = np.empty(shape=4, dtype=np.uint16)
wei... |
return all positions around central point (0,0)
for a given kernel size
positions grow from smallest to biggest distances
returns [positions] and [distances] from central cell
def growPositions(ksize):
'''
return all positions around central point (0,0)
for a given kernel size
... |
Convert QImage to numpy.ndarray. The dtype defaults to uint8
for QImage.Format_Indexed8 or `bgra_dtype` (i.e. a record array)
for 32bit color images. You can pass a different dtype to use, or
'array' to get a 3D uint8 array for color images.
def qImageToArray(qimage, dtype = 'array'):
"""Convert ... |
applies gaussian_filter on input array
but allowing variable ksize in y
stdyrange(int) -> maximum ksize - ksizes will increase from 0 to given value
stdyrange(tuple,list) -> minimum and maximum size as (mn,mx)
stdyrange(np.array) -> all different ksizes in y
def varYSizeGaussianFilter(arr, st... |
2d Gaussian to be used in numba code
def numbaGaussian2d(psf, sy, sx):
'''
2d Gaussian to be used in numba code
'''
ps0, ps1 = psf.shape
c0,c1 = ps0//2, ps1//2
ssx = 2*sx**2
ssy = 2*sy**2
for i in range(ps0):
for j in range(ps1):
psf[i,j]=exp( -( (i-c0)**2/... |
estimate background level through finding the most homogeneous area
and take its average
min_size - relative size of the examined area
def estimateBackgroundLevel(img, image_is_artefact_free=False,
min_rel_size=0.05, max_abs_size=11):
'''
estimate background leve... |
returns angular dependent EL emissivity of a PV module
calculated of nanmedian(persp-corrected EL module/reference module)
published in K. Bedrich: Quantitative Electroluminescence Measurement on PV devices
PhD Thesis, 2017
def EL_Si_module():
'''
returns angular depen... |
reflected temperature for 250DEG Glass
published in IEC 62446-3 TS: Photovoltaic (PV) systems
- Requirements for testing, documentation and maintenance
- Part 3: Outdoor infrared thermography of photovoltaic modules
and plants p Page 12
def TG_glass():
'''
reflected temperature for 2... |
Extract pixel sensitivity from a set of homogeneously illuminated images
This method is detailed in Section 5 of:
---
K.Bedrich, M.Bokalic et al.:
ELECTROLUMINESCENCE IMAGING OF PV DEVICES:
ADVANCED FLAT FIELD CALIBRATION,2017
---
def sensitivity(imgs, bg=None):
'''
Extract pi... |
solves the Navier-Stokes equation for incompressible flow
one a regular 2d grid
u,v,p --> initial velocity(u,v) and pressure(p) maps
dt --> time step
nt --> number of time steps to caluclate
rho, nu --> material constants
nit --> number of iteration to solve the pre... |
remap an image using velocity field
def shiftImage(u, v, t, img, interpolation=cv2.INTER_LANCZOS4):
'''
remap an image using velocity field
'''
ny,nx = u.shape
sy, sx = np.mgrid[:float(ny):1,:float(nx):1]
sx += u*t
sy += v*t
return cv2.remap(img.astype(np.float32),
... |
adds Gaussian (thermal) and shot noise to [img]
[img] is assumed to be noise free
[rShot] - shot noise ratio relative to all noise
def addNoise(img, snr=25, rShot=0.5):
'''
adds Gaussian (thermal) and shot noise to [img]
[img] is assumed to be noise free
[rShot] - shot noise ratio... |
return an array of [shape]
where every cell equals the localised maximum of the given array [arr]
at the same (scalled) position
def coarseMaximum(arr, shape):
'''
return an array of [shape]
where every cell equals the localised maximum of the given array [arr]
at the same (scalled) posit... |
Another vignetting equation from:
M. Koentges, M. Siebert, and D. Hinken, "Quantitative analysis of PV-modules by electroluminescence images for quality control"
2009
f --> Focal length
D --> Diameter of the aperture
BOTH, D AND f NEED TO HAVE SAME UNIT [PX, mm ...]
a --> Angular a... |
Corrected AngleOfView equation by Koentges (via mail from 14/02/2017)
b --> distance between the camera and the module in m
x0 --> viewable with in the module plane of the camera in m
y0 --> viewable height in the module plane of the camera in m
x,y --> pixel position [m] from top left
def angleOfV... |
###TODO REDO TXT
OPTIONAL:
subgrid = ([x],[y]) --> relative positions
e.g. subgrid = ( (0.3,0.7), () )
--> two subgrid lines in x - nothing in y
Returns:
horiz,vert -> arrays of (x,y) poly-lines
if subgrid != None, Returns:
horiz,vert, subhoriz,... |
return object resolution as [line pairs/mm]
where MTF=50%
see http://www.imatest.com/docs/sharpness/
def MTF50(self, MTFx,MTFy):
'''
return object resolution as [line pairs/mm]
where MTF=50%
see http://www.imatest.com/docs/sharpness/
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.