code stringlengths 3 6.57k |
|---|
file_data.append(df.to_csv() |
page_paths.append(page_path) |
page_data_counts.append(char_details) |
copy.deepcopy(regions) |
time.time() |
print("processing completed for page in {}".format(t2) |
print(file_eval_info) |
len(page_paths) |
print("file level evaluation result------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>",file_eval_info) |
open(save_base_path+"/"+file_name+".json", 'w') |
json.dump(data, outfile) |
final_df.to_csv(save_base_path+"/"+file_name+'.csv') |
tesseract(json_files_path) |
draw_thresh_box(df,path,page_index,save_path) |
path.split('upload') |
download_file(download_url,headers,path,f_type='image') |
np.frombuffer(image, np.uint8) |
cv2.imdecode(nparr, cv2.IMREAD_COLOR) |
df.reset_index() |
df.iterrows() |
to_dict() |
ast.literal_eval(boxes) |
pts.append([int(pt['x']) |
int(pt['y']) |
cv2.polylines(image, [np.array(pts) |
cv2.putText(image, str(row2['text']) |
cv2.putText(image, str(row2['tess_text']) |
os.path.join(save_path , '{}.png'.format(page_index) |
cv2.imwrite(image_path , image) |
visualize_results(df_paths,thresh) |
glob.glob(df_paths+"*/*.csv") |
df_path.split('/') |
pd.read_csv(df_path) |
enumerate(zip(df['page_path'],df['page_data']) |
StringIO(page_data) |
pd.read_csv(df_string, sep=",") |
draw_thresh_box(filtered_df,page_path,idx,save_path) |
visualize_results(base_path,vis_thresh) |
get_palette(img, maxcolors = 255) |
img.convert("RGB") |
img.getcolors(65536) |
colors.sort(key = lambda c: -c[0]) |
write_palette(outfile, palette) |
palette (normal and highlight) |
outfile.write('static const NXWidgets::nxwidget_pixel_t palette[BITMAP_PALETTESIZE] =\n') |
outfile.write('{\n') |
range(0, len(palette) |
outfile.write(' ') |
outfile.write('MKRGB(%3d,%3d,%3d) |
outfile.write('\n') |
outfile.write('};\n\n') |
outfile.write('static const NXWidgets::nxwidget_pixel_t hilight_palette[BITMAP_PALETTESIZE] =\n') |
outfile.write('{\n') |
range(0, len(palette) |
outfile.write(' ') |
min(255, r + 50) |
min(255, g + 50) |
min(255, b + 50) |
outfile.write('MKRGB(%3d,%3d,%3d) |
outfile.write('\n') |
outfile.write('};\n\n') |
quantize(color, palette) |
palette.index(color) |
distance(color2) |
sum([(a - b) |
zip(color, color2) |
palette.index(min(palette, key = distance) |
encode_row(img, palette, y) |
range(0, img.size[0]) |
quantize(img.getpixel((x, y) |
entries.append((repeats, color) |
entries.append((repeats, color) |
write_image(outfile, img, palette) |
outfile.write('static const NXWidgets::SRlePaletteBitmapEntry bitmap[] =\n') |
outfile.write('{\n') |
range(0, img.size[1]) |
encode_row(img, palette, y) |
len(row) |
outfile.write(' ' + row + '\n') |
len(row) |
outfile.write(' ' + row + '/* Row %d */\n' % y) |
outfile.write('};\n\n') |
write_descriptor(outfile, name) |
outfile.write('extern const struct NXWidgets::SRlePaletteBitmap g_%s =\n' % name) |
outfile.write('{\n') |
outfile.write(' CONFIG_NXWIDGETS_BPP,\n') |
outfile.write(' CONFIG_NXWIDGETS_FMT,\n') |
outfile.write(' BITMAP_PALETTESIZE,\n') |
outfile.write(' BITMAP_WIDTH,\n') |
outfile.write(' BITMAP_HEIGHT,\n') |
outfile.write(' {palette, hilight_palette},\n') |
outfile.write(' bitmap\n') |
outfile.write('};\n') |
len(sys.argv) |
sys.exit(1) |
Image.open(sys.argv[1]) |
convert("RGB") |
open(sys.argv[2], 'w') |
get_palette(img) |
len(palette) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.