-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhistogram.lua
More file actions
24 lines (22 loc) · 815 Bytes
/
histogram.lua
File metadata and controls
24 lines (22 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--[[
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
]]
-- Modules --
local AF = require("arrayfire")
AF.main(function()
local myWindow = AF.Window(512, 512, "Histogram example using ArrayFire")
local imgWnd = AF.Window(480, 640, "Input Image")
local img = AF.loadImage(AF.assets() .. "/examples/images/arrow.jpg", false)
local hist_out = AF.histogram(img, 256, 0, 255)
AF.EnvLoopWhile(function()
myWindow:hist(hist_out, 0, 255)
imgWnd:image(img:as("u8"))
end, AF.wait_for_windows_close("while", myWindow, imgWnd))
end)