This file contains 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
#!/usr/bin/env python | |
''' | |
Author: Igor Maculan - n3wtron@gmail.com | |
Modifier: Yoshihiro Yamazaki - yoya@awm.jp | |
A Simple mjpg stream http server | |
''' | |
import cv2 | |
from PIL import Image | |
import threading | |
from http.server import BaseHTTPRequestHandler,HTTPServer |
This file contains 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
// g++ -std=c++11 iterator_test.cpp | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
class my_vector { | |
public: | |
std::vector<int> m_vec; | |
my_vector(int len, int value): m_vec(len, value) { ; } |
This file contains 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
// g++ -std=c++11 iterator_test.cpp | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
class my_vector { | |
public: | |
std::vector<int> m_vec; | |
my_vector(int len, int value) { |
This file contains 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
// g++ -std=c++11 iterator_test.cpp | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
class my_vector { | |
public: | |
std::vector<int> m_vec; | |
my_vector(int len, int value) { |
This file contains 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
% # Nearest Neighbor | |
% convert xc: -define filter:verbose=1 -filter box -resize 8 null: | awk '$1==0{s+=$2} $1>0{s+=$2*2} END {print s/100}' | |
1.01 | |
% # Bi-Linear | |
% convert xc: -define filter:verbose=1 -filter triangle -resize 8 null: | awk '$1==0{s+=$2} $1>0{s+=$2*2} END {print s/100}' | |
1 | |
% # Mitchell-Netravali (Bi-Cubic B:1/3, C:1/3) | |
% convert xc: -define filter:verbose=1 -filter mitchell -resize 8 null: | awk '$1==0{s+=$2/2} $1>0{s+=$2*2} END {print s/100}' |
This file contains 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 main | |
import ( | |
"flag" | |
"github.com/disintegration/imaging" | |
"image/png" | |
"os" | |
) | |
func main() { |
This file contains 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
from PIL import Image, ImageOps | |
import sys | |
import numpy as np | |
def gamma_correction(im, gamma): | |
arr = np.asarray(im) | |
arr = 255.0 * (arr / 255.0)**(gamma) | |
return Image.fromarray(np.uint8(arr)) | |
im = Image.open(sys.argv[1]) |
This file contains 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
from PIL import Image, ImageOps | |
import sys | |
im = Image.open(sys.argv[1]) | |
im = im.convert("YCbCr") | |
yy, cb, cr = im.split() | |
yy = ImageOps.equalize(yy); | |
im = Image.merge("YCbCr", (yy, cb, cr)) |
This file contains 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
from PIL import Image, ImageOps | |
import sys | |
if len(sys.argv) < 4: | |
print ("Usage: python imageopt_test.py <grayscale|equalize|...> [<value>] <infile> <outfile>\n") | |
print (dir(ImageOps)) | |
exit (0); | |
method = sys.argv[1] | |
if len(sys.argv) == 4: |
This file contains 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
#! /usr/local/bin/python3 | |
# https://docs.python.jp/3/library/http.server.html | |
# https://blog.sarabande.jp/post/81479479934 | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
[host, port] = ["0.0.0.0", 4848] | |
class MyHandler(SimpleHTTPRequestHandler): | |
def do_GET(self): |