Ejemplo n.º 1
0
def main():
    f = "colours"
    length = 151
    r = 90
    c = 120
    nbins = 10
    colors = np.zeros((length, r, c, 3), dtype=np.uint8)
    grays = np.zeros((length, r, c), dtype=np.uint8)

    # Read the images and store them in color and grayscale formats
    for i in range(length):
        im = Image.open(f+"/dwc"+str(i+1).zfill(3)+".png").convert('RGB')
        colors[i] = np.asarray(im, dtype=np.uint8)
        grays[i] = np.asarray(im.convert('L'))

    # Save the color and grayscale images
    for i in range(length):
        out_col = Image.fromarray(colors[i])
        out_gray = Image.fromarray(grays[i])
        out_col.save("out/col_im/dwc_col"+str(i+1).zfill(3)+".png")
        out_gray.save("out/gray_im/dwc_gray"+str(i+1).zfill(3)+".png")

    # Draw histograms
    colorhs, grayhs = histograms(length, nbins, colors, grays)

    # Kmeans
    clustering(length, nbins, colorhs, grayhs, colors, grays)

    # Other Methods
    other(length, nbins, grayhs, grays)
Ejemplo n.º 2
0
import histograms

histograms.histograms(["skewness_east.txt", "skewness_north.txt"], "Skewness")
histograms.histograms(["aratio_east.txt", "aratio_north.txt"], "Aspect Ratio")

histograms.histograms(["skewness_east_observation.txt", "skewness_north_observation.txt"], "Skewness observation")
Ejemplo n.º 3
0
effectEnd = 0
high = 0
index = 0

video = cv.VideoCapture("julia.avi")
video.open("julia.avi")

while (True):
    index += 1
    ret, frame = video.read()
    cv.imshow('frame', frame)
    if cv.waitKey(1) & 0xFF == ord('q'):
        break

    if isFirstIteration:
        prevHistograms = hst.histograms(frame)
        prevEdges, prevDilatedEdges = sbl.sobelConvolution(frame)
        prevMaxp = 0
        isFirstIteration = False
    else:
        histograms = hst.histograms(frame)
        edges, dilatedEdges = sbl.sobelConvolution(frame)

        if hst.distance(histograms, prevHistograms) <= 1.9 and not isFading:
            print("Histo -> Cut at frame : " + str(index))
        elif hst.distance(histograms, prevHistograms) <= 2.6:
            if not isFading:
                isFading = True
                fadeStart = index
        else:
            if isFading: